зеркало из https://github.com/mozilla/pjs.git
Merge from cvs-trunk-mirror
--HG-- rename : js/src/js.c => js/src/js.cpp rename : js/src/jsdbgapi.c => js/src/jsdbgapi.cpp rename : js/src/jsgc.c => js/src/jsgc.cpp rename : js/src/jsobj.c => js/src/jsobj.cpp rename : js/src/jsregexp.c => js/src/jsregexp.cpp
This commit is contained in:
Коммит
be41c62098
17
Makefile.in
17
Makefile.in
|
@ -54,7 +54,7 @@ TIERS += base
|
|||
|
||||
#
|
||||
# tier "base" - basic setup
|
||||
#
|
||||
#
|
||||
tier_base_dirs = \
|
||||
config \
|
||||
build \
|
||||
|
@ -64,7 +64,7 @@ include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
|||
|
||||
TIERS += testharness
|
||||
|
||||
# test harnesses
|
||||
# test harnesses
|
||||
ifdef ENABLE_TESTS
|
||||
tier_testharness_dirs += tools/test-harness
|
||||
endif
|
||||
|
@ -74,7 +74,7 @@ DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
|||
dependencies.beos config/autoconf.mk config/myrules.mk config/myconfig.mk \
|
||||
unallmakefiles mozilla-config.h \
|
||||
gfx/gfx-config.h netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||
|
||||
# Build pseudo-external modules first when export is explicitly called
|
||||
export::
|
||||
|
@ -163,6 +163,9 @@ ifdef MOZ_SYMBOLS_EXTRA_BUILDID
|
|||
EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
|
||||
endif
|
||||
|
||||
SYMBOL_ARCHIVE_BASENAME := \
|
||||
$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_ARCH)-$(BUILDID)$(EXTRA_BUILDID)
|
||||
|
||||
buildsymbols:
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
echo building symbol store
|
||||
|
@ -171,18 +174,18 @@ ifdef MOZ_CRASHREPORTER
|
|||
$(MAKE_SYM_STORE_ARGS) -s $(topsrcdir) $(DUMP_SYMS_BIN) \
|
||||
$(DIST)/crashreporter-symbols/$(BUILDID) \
|
||||
$(MAKE_SYM_STORE_PATH) > \
|
||||
$(DIST)/crashreporter-symbols/$(BUILDID)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_ARCH)-$(BUILDID)$(EXTRA_BUILDID)-symbols.txt
|
||||
$(DIST)/crashreporter-symbols/$(BUILDID)/$(SYMBOL_ARCHIVE_BASENAME)-symbols.txt
|
||||
echo packing symbols
|
||||
mkdir -p $(topsrcdir)/../$(BUILDID)
|
||||
cd $(DIST)/crashreporter-symbols/$(BUILDID) && \
|
||||
zip -r9D ../crashreporter-symbols-$(BUILDID).zip .
|
||||
mv $(DIST)/crashreporter-symbols/crashreporter-symbols-$(BUILDID).zip \
|
||||
zip -r9D ../crashreporter-symbols-$(SYMBOL_ARCHIVE_BASENAME).zip .
|
||||
mv $(DIST)/crashreporter-symbols/crashreporter-symbols-$(SYMBOL_ARCHIVE_BASENAME).zip \
|
||||
$(topsrcdir)/../$(BUILDID)
|
||||
endif # MOZ_CRASHREPORTER
|
||||
|
||||
uploadsymbols:
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
$(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(topsrcdir)/../$(BUILDID)/crashreporter-symbols-$(BUILDID).zip
|
||||
$(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(topsrcdir)/../$(BUILDID)/crashreporter-symbols-$(SYMBOL_ARCHIVE_BASENAME).zip
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
|
|
|
@ -57,6 +57,10 @@ interface nsIAccessibleText : nsISupports
|
|||
const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
|
||||
const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
|
||||
|
||||
/**
|
||||
* The current current caret offset.
|
||||
* If set < 0 then caret will be placed at the end of the text
|
||||
*/
|
||||
attribute long caretOffset;
|
||||
|
||||
readonly attribute long characterCount;
|
||||
|
@ -160,9 +164,13 @@ interface nsIAccessibleText : nsISupports
|
|||
out long startOffset,
|
||||
out long endOffset);
|
||||
|
||||
/**
|
||||
* Set the bounds for the given selection range
|
||||
* Offsets < 0 will be treated as the equal to the end of the text
|
||||
*/
|
||||
void setSelectionBounds (in long selectionNum,
|
||||
in long startOffset,
|
||||
in long endOffset);
|
||||
in long startOffset,
|
||||
in long endOffset);
|
||||
|
||||
void addSelection (in long startOffset, in long endOffset);
|
||||
|
||||
|
|
|
@ -111,32 +111,11 @@ getExtentsCB(AtkComponent *aComponent,
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (aCoordType == ATK_XY_WINDOW) {
|
||||
// Make coordinates relative to top level window instead of screen
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accWrap->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = nsAccessNode::GetDocShellTreeItemFor(domNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
|
||||
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(domDoc));
|
||||
if (!docView) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMAbstractView> abstractView;
|
||||
docView->GetDefaultView(getter_AddRefs(abstractView));
|
||||
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(abstractView));
|
||||
if (!windowInter) {
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 screenX, screenY;
|
||||
if (NS_FAILED(windowInter->GetScreenX(&screenX)) ||
|
||||
NS_FAILED(windowInter->GetScreenY(&screenY))) {
|
||||
return;
|
||||
}
|
||||
nsAccX -= screenX;
|
||||
nsAccY -= screenY;
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
accWrap->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsIntPoint winCoords = nsAccUtils::GetScreenCoordsForWindow(domNode);
|
||||
nsAccX -= winCoords.x;
|
||||
nsAccY -= winCoords.y;
|
||||
}
|
||||
|
||||
*aAccX = nsAccX;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -336,8 +337,8 @@ already_AddRefed<nsIAccessibleDocument> nsAccessNode::GetDocAccessible()
|
|||
|
||||
already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
NS_ASSERTION(docShellTreeItem, "No docshell tree item for mDOMNode");
|
||||
if (!docShellTreeItem) {
|
||||
return nsnull;
|
||||
|
@ -434,7 +435,77 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
|
|||
NS_IMETHODIMP
|
||||
nsAccessNode::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
|
||||
switch (aCoordinateType) {
|
||||
case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE:
|
||||
break;
|
||||
|
||||
case nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE:
|
||||
{
|
||||
nsIntPoint wndCoords = nsAccUtils::GetScreenCoordsForWindow(mDOMNode);
|
||||
aX += wndCoords.x;
|
||||
aY += wndCoords.y;
|
||||
break;
|
||||
}
|
||||
|
||||
case nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE:
|
||||
{
|
||||
nsCOMPtr<nsPIAccessNode> parent;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsresult rv = QueryInterface(NS_GET_IID(nsIAccessible),
|
||||
getter_AddRefs(accessible));
|
||||
if (NS_SUCCEEDED(rv) && accessible) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
accessible->GetParent(getter_AddRefs(parentAccessible));
|
||||
parent = do_QueryInterface(parentAccessible);
|
||||
} else {
|
||||
nsCOMPtr<nsIAccessNode> parentAccessNode;
|
||||
GetParentNode(getter_AddRefs(parentAccessNode));
|
||||
parent = do_QueryInterface(parentAccessNode);
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(parent);
|
||||
nsIFrame *parentFrame = parent->GetFrame();
|
||||
NS_ENSURE_STATE(parentFrame);
|
||||
|
||||
nsIntRect parentRect = parentFrame->GetScreenRectExternal();
|
||||
aX += parentRect.x;
|
||||
aY += parentRect.y;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsIFrame *parentFrame = frame;
|
||||
while (parentFrame = parentFrame->GetParent()) {
|
||||
nsIScrollableFrame *scrollableFrame = nsnull;
|
||||
CallQueryInterface(parentFrame, &scrollableFrame);
|
||||
if (scrollableFrame) {
|
||||
nsIntRect frameRect = frame->GetScreenRectExternal();
|
||||
PRInt32 devDeltaX = aX - frameRect.x;
|
||||
PRInt32 devDeltaY = aY - frameRect.y;
|
||||
|
||||
nsPoint deltaPoint;
|
||||
deltaPoint.x = presContext->DevPixelsToAppUnits(devDeltaX);
|
||||
deltaPoint.y = presContext->DevPixelsToAppUnits(devDeltaY);
|
||||
|
||||
nsPoint scrollPoint = scrollableFrame->GetScrollPosition();
|
||||
|
||||
scrollPoint -= deltaPoint;
|
||||
|
||||
scrollableFrame->ScrollTo(scrollPoint);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -681,30 +752,6 @@ nsAccessNode::GetPresShellFor(nsIDOMNode *aNode)
|
|||
return presShell;
|
||||
}
|
||||
|
||||
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
nsAccessNode::GetDocShellTreeItemFor(nsIDOMNode *aStartNode)
|
||||
{
|
||||
if (!aStartNode) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aStartNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc) {
|
||||
doc = do_QueryInterface(aStartNode);
|
||||
}
|
||||
NS_ASSERTION(doc, "No document for node passed in");
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsIDocShellTreeItem *docShellTreeItem = nsnull;
|
||||
if (container) {
|
||||
CallQueryInterface(container, &docShellTreeItem);
|
||||
}
|
||||
|
||||
return docShellTreeItem;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMNode>
|
||||
nsAccessNode::GetDOMNodeForContainer(nsISupports *aContainer)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsIAccessNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsPIAccessNode.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
@ -104,7 +103,6 @@ class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
|||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsISupports *aContainer, PRBool aCanCreate = PR_FALSE);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDOMNode *aNode);
|
||||
|
||||
static already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemFor(nsIDOMNode *aStartNode);
|
||||
static already_AddRefed<nsIDOMNode> GetDOMNodeForContainer(nsISupports *aContainer);
|
||||
static already_AddRefed<nsIPresShell> GetPresShellFor(nsIDOMNode *aStartNode);
|
||||
|
||||
|
|
|
@ -42,9 +42,14 @@
|
|||
#include "nsPIAccessible.h"
|
||||
#include "nsAccessibleEventData.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -54,6 +59,7 @@
|
|||
|
||||
#include "nsContentCID.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
|
||||
|
@ -347,3 +353,52 @@ nsAccUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
|
|||
}
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsAccUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
|
||||
{
|
||||
nsIntPoint coords(0, 0);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellTreeItemFor(aNode));
|
||||
if (!treeItem)
|
||||
return coords;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
|
||||
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(domDoc));
|
||||
if (!docView)
|
||||
return coords;
|
||||
|
||||
nsCOMPtr<nsIDOMAbstractView> abstractView;
|
||||
docView->GetDefaultView(getter_AddRefs(abstractView));
|
||||
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(abstractView));
|
||||
if (!windowInter)
|
||||
return coords;
|
||||
|
||||
windowInter->GetScreenX(&coords.x);
|
||||
windowInter->GetScreenY(&coords.y);
|
||||
return coords;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
nsAccUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
|
||||
{
|
||||
if (!aNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc)
|
||||
doc = do_QueryInterface(aNode);
|
||||
|
||||
NS_ASSERTION(doc, "No document for node passed in");
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsIDocShellTreeItem *docShellTreeItem = nsnull;
|
||||
if (container)
|
||||
CallQueryInterface(container, &docShellTreeItem);
|
||||
|
||||
return docShellTreeItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
class nsAccUtils
|
||||
{
|
||||
|
@ -165,6 +167,19 @@ public:
|
|||
static void ConvertScrollTypeToPercents(PRUint32 aScrollType,
|
||||
PRInt16 *aVPercent,
|
||||
PRInt16 *aHPercent);
|
||||
|
||||
/**
|
||||
* Returns coordinates relative screen for the top level window.
|
||||
*
|
||||
* @param - aNode - the DOM node hosted in the window.
|
||||
*/
|
||||
static nsIntPoint GetScreenCoordsForWindow(nsIDOMNode *aNode);
|
||||
|
||||
/**
|
||||
* Return document shell tree item for the given DOM node.
|
||||
*/
|
||||
static already_AddRefed<nsIDocShellTreeItem>
|
||||
GetDocShellTreeItemFor(nsIDOMNode *aNode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1051,6 +1051,10 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
}
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
|
||||
*aState |= nsIAccessibleStates::STATE_FLOATING;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1082,70 +1086,73 @@ NS_IMETHODIMP nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
|||
}
|
||||
|
||||
/* nsIAccessible getChildAtPoint (in long x, in long y); */
|
||||
NS_IMETHODIMP nsAccessible::GetChildAtPoint(PRInt32 tx, PRInt32 ty, nsIAccessible **aAccessible)
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
GetFirstChild(getter_AddRefs(child));
|
||||
// Search an accessible at the given point starting from accessible document
|
||||
// because containing block (see CSS2) for out of flow element (for example,
|
||||
// absolutely positioned element) may be different from its DOM parent and
|
||||
// therefore accessible for containing block may be different from accessible
|
||||
// for DOM parent but GetFrameForPoint() should be called for containing block
|
||||
// to get an out of flow element.
|
||||
nsCOMPtr<nsIAccessibleDocument> accDocument;
|
||||
nsresult rv = GetAccessibleDocument(getter_AddRefs(accDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 x, y, w, h;
|
||||
PRUint32 state;
|
||||
|
||||
nsCOMPtr<nsIAccessible> childAtPoint;
|
||||
while (child) {
|
||||
child->GetBounds(&x, &y, &w, &h);
|
||||
if (tx >= x && tx < x + w && ty >= y && ty < y + h) {
|
||||
nsCOMPtr<nsPIAccessNode> accessNode(do_QueryInterface(child));
|
||||
if (accessNode) {
|
||||
nsIFrame *frame = accessNode->GetFrame();
|
||||
if (!frame) {
|
||||
state = State(child);
|
||||
// In some cases accessibles don't have a frame; examples are
|
||||
// tree items or combo box dropdown markers. For these cases
|
||||
// just ensure that the returned accessible is visible.
|
||||
if ((state & (nsIAccessibleStates::STATE_OFFSCREEN |
|
||||
nsIAccessibleStates::STATE_INVISIBLE)) == 0) {
|
||||
// Don't walk into offscreen or invisible items
|
||||
NS_IF_ADDREF(*aAccessible = child);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If there are multiple accessibles the contain the point
|
||||
// and they overlap then pick the one with a frame that contains the point
|
||||
// For example, A point that's in block #2 is also in block #1, but we want to return #2:
|
||||
// [[block #1 is long wrapped text that continues to
|
||||
// another line]] [[here is a shorter block #2]]
|
||||
while (frame) {
|
||||
if (frame->GetScreenRectExternal().Contains(tx, ty)) {
|
||||
childAtPoint = child;
|
||||
break; // Definitely in this accessible, since one of its frame matches the point
|
||||
}
|
||||
frame = frame->GetNextContinuation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
child->GetNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (childAtPoint) {
|
||||
NS_ADDREF(*aAccessible = childAtPoint);
|
||||
if (!accDocument)
|
||||
return NS_OK;
|
||||
}
|
||||
GetState(&state, nsnull);
|
||||
GetBounds(&x, &y, &w, &h);
|
||||
if ((state & (nsIAccessibleStates::STATE_OFFSCREEN |
|
||||
nsIAccessibleStates::STATE_INVISIBLE)) == 0 &&
|
||||
tx >= x && tx < x + w && ty >= y && ty < y + h) {
|
||||
*aAccessible = this;
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
nsCOMPtr<nsPIAccessNode> accessNodeDocument(do_QueryInterface(accDocument));
|
||||
NS_ASSERTION(accessNodeDocument,
|
||||
"nsIAccessibleDocument doesn't implement nsPIAccessNode");
|
||||
|
||||
nsIFrame *frame = accessNodeDocument->GetFrame();
|
||||
NS_ENSURE_STATE(frame);
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
|
||||
nsIntRect screenRect = frame->GetScreenRectExternal();
|
||||
nsPoint offset(presContext->DevPixelsToAppUnits(aX - screenRect.x),
|
||||
presContext->DevPixelsToAppUnits(aY - screenRect.y));
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
|
||||
nsIFrame *foundFrame = presShell->GetFrameForPoint(frame, offset);
|
||||
if (!foundFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content(foundFrame->GetContent());
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> relevantNode;
|
||||
accService->GetRelevantContentNodeFor(node, getter_AddRefs(relevantNode));
|
||||
if (!relevantNode)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleFor(relevantNode, getter_AddRefs(accessible));
|
||||
if (!accessible)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
accessible->GetParent(getter_AddRefs(parent));
|
||||
|
||||
while (parent && parent != this) {
|
||||
accessible.swap(parent);
|
||||
accessible->GetParent(getter_AddRefs(parent));
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (parent)
|
||||
NS_ADDREF(*aAccessible = accessible);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
|
||||
|
@ -2223,12 +2230,14 @@ PRBool nsAccessible::MappedAttrState(nsIContent *aContent, PRUint32 *aStateInOut
|
|||
if (aStateMapEntry->attributeValue == kBoolState) {
|
||||
// No attribute value map specified in state map entry indicates state cleared
|
||||
if (attribValue.EqualsLiteral("false")) {
|
||||
return *aStateInOut &= ~aStateMapEntry->state;
|
||||
*aStateInOut &= ~aStateMapEntry->state;
|
||||
}
|
||||
else {
|
||||
*aStateInOut |= aStateMapEntry->state;
|
||||
}
|
||||
return *aStateInOut |= aStateMapEntry->state;
|
||||
}
|
||||
if (NS_ConvertUTF16toUTF8(attribValue).Equals(aStateMapEntry->attributeValue)) {
|
||||
return *aStateInOut |= aStateMapEntry->state;
|
||||
else if (NS_ConvertUTF16toUTF8(attribValue).Equals(aStateMapEntry->attributeValue)) {
|
||||
*aStateInOut |= aStateMapEntry->state;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3149,12 +3158,13 @@ PRInt32 nsAccessible::TextLength(nsIAccessible *aAccessible)
|
|||
NS_ASSERTION(pAccNode, "QI to nsPIAccessNode failed");
|
||||
|
||||
nsIFrame *frame = pAccNode->GetFrame();
|
||||
if (frame) { // Optimal way to get the text length -- no string copy
|
||||
if (frame && frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
// Ensure that correct text length is calculated (with non-rendered whitespace chars not counted)
|
||||
nsIContent *content = frame->GetContent();
|
||||
if (content) {
|
||||
PRUint32 length;
|
||||
nsresult rv = nsHyperTextAccessible::ContentToRenderedOffset(frame, content->TextLength(), &length);
|
||||
return NS_SUCCEEDED(rv) ? length : -1;
|
||||
return NS_SUCCEEDED(rv) ? static_cast<PRInt32>(length) : -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,6 +252,8 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
|||
PRBool isCollapsed;
|
||||
nsIView *view;
|
||||
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
|
||||
NS_ENSURE_TRUE(caretSelection, caretRect);
|
||||
|
||||
caret->GetCaretCoordinates(nsICaret::eRenderingViewCoordinates, caretSelection,
|
||||
&caretRect, &isCollapsed, &view);
|
||||
if (!view || caretRect.IsEmpty()) {
|
||||
|
|
|
@ -109,8 +109,8 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
|
|||
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||
mAccessNodeCache.Init(kDefaultCacheSize);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
|
||||
if (docShell) {
|
||||
PRUint32 busyFlags;
|
||||
|
@ -164,7 +164,7 @@ NS_IMETHODIMP nsDocAccessible::GetRole(PRUint32 *aRole)
|
|||
*aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
GetDocShellTreeItemFor(mDOMNode);
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
if (docShellTreeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
|
||||
docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
|
||||
|
@ -278,11 +278,16 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
|||
return NS_ERROR_FAILURE; // Not focusable
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(treeItem);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(GetPresShell());
|
||||
if (!shell) {
|
||||
NS_WARNING("Was not shutdown properly via InvalidateCacheSubtree()");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIEventStateManager *esm = shell->GetPresContext()->EventStateManager();
|
||||
NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -525,7 +530,8 @@ NS_IMETHODIMP nsDocAccessible::Shutdown()
|
|||
return NS_OK; // Already shutdown
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
ShutdownChildDocuments(treeItem);
|
||||
|
||||
if (mDocLoadTimer) {
|
||||
|
@ -787,7 +793,8 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
|||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
if (!treeItem) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1168,11 +1175,18 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
|||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
|
||||
}
|
||||
|
||||
void nsDocAccessible::CharacterDataWillChange(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
{
|
||||
FireTextChangeEventForText(aContent, aInfo, PR_FALSE);
|
||||
}
|
||||
|
||||
void nsDocAccessible::CharacterDataChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
{
|
||||
FireTextChangedEventOnDOMCharacterDataModified(aContent, aInfo);
|
||||
FireTextChangeEventForText(aContent, aInfo, PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1203,8 +1217,9 @@ nsDocAccessible::ParentChainChanged(nsIContent *aContent)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocAccessible::FireTextChangedEventOnDOMCharacterDataModified(nsIContent *aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
||||
CharacterDataChangeInfo* aInfo,
|
||||
PRBool aIsInserted)
|
||||
{
|
||||
if (!mIsContentLoaded || !mDocument) {
|
||||
return;
|
||||
|
@ -1226,26 +1241,38 @@ nsDocAccessible::FireTextChangedEventOnDOMCharacterDataModified(nsIContent *aCon
|
|||
return;
|
||||
|
||||
PRInt32 start = aInfo->mChangeStart;
|
||||
PRUint32 end = aInfo->mChangeEnd;
|
||||
PRInt32 length = end - start;
|
||||
PRUint32 replaceLen = aInfo->mReplaceLength;
|
||||
|
||||
PRInt32 offset = 0;
|
||||
rv = textAccessible->DOMPointToHypertextOffset(node, start, &offset);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Text has been removed.
|
||||
if (length > 0) {
|
||||
nsCOMPtr<nsIAccessibleTextChangeEvent> event =
|
||||
new nsAccTextChangeEvent(accessible, offset, length, PR_FALSE);
|
||||
textAccessible->FireAccessibleEvent(event);
|
||||
}
|
||||
PRInt32 length = aIsInserted ?
|
||||
aInfo->mReplaceLength: // text has been added
|
||||
aInfo->mChangeEnd - start; // text has been removed
|
||||
|
||||
if (length > 0) {
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
PRUint32 renderedStartOffset, renderedEndOffset;
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
rv = textAccessible->ContentToRenderedOffset(frame, start,
|
||||
&renderedStartOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
rv = textAccessible->ContentToRenderedOffset(frame, start + length,
|
||||
&renderedEndOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Text has been added.
|
||||
if (replaceLen) {
|
||||
nsCOMPtr<nsIAccessibleTextChangeEvent> event =
|
||||
new nsAccTextChangeEvent(accessible, offset, replaceLen, PR_TRUE);
|
||||
new nsAccTextChangeEvent(accessible, offset,
|
||||
renderedEndOffset - renderedStartOffset,
|
||||
aIsInserted, PR_FALSE);
|
||||
textAccessible->FireAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -1852,7 +1879,7 @@ void nsDocAccessible::DocLoadCallback(nsITimer *aTimer, void *aClosure)
|
|||
// Fire STATE_CHANGE event for doc load finish if focus is in same doc tree
|
||||
if (gLastFocusedNode) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> focusedTreeItem =
|
||||
GetDocShellTreeItemFor(gLastFocusedNode);
|
||||
nsAccUtils::GetDocShellTreeItemFor(gLastFocusedNode);
|
||||
if (focusedTreeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeRootOfFocus;
|
||||
focusedTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRootOfFocus));
|
||||
|
|
|
@ -157,10 +157,17 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
|||
void ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Fire text changed event for charackter data changed.
|
||||
* Fire text changed event for character data changed. The method is used
|
||||
* from nsIMutationObserver methods.
|
||||
*
|
||||
* @param aContent the text node holding changed data
|
||||
* @param aInfo info structure describing how the data was changed
|
||||
* @param aIsInserted the flag pointed whether removed or inserted
|
||||
* characters should be cause of event
|
||||
*/
|
||||
void FireTextChangedEventOnDOMCharacterDataModified(nsIContent *aContent,
|
||||
CharacterDataChangeInfo* aInfo);
|
||||
void FireTextChangeEventForText(nsIContent *aContent,
|
||||
CharacterDataChangeInfo* aInfo,
|
||||
PRBool aIsInserted);
|
||||
|
||||
/**
|
||||
* Create a text change event for a changed node
|
||||
|
|
|
@ -132,7 +132,7 @@ NS_IMETHODIMP nsRootAccessible::GetName(nsAString& aName)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
GetDocShellTreeItemFor(mDOMNode);
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
|
@ -191,7 +191,8 @@ PRUint32 nsRootAccessible::GetChromeFlags()
|
|||
// Return the flag set for the top level window as defined
|
||||
// by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
|
||||
// Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
NS_ENSURE_TRUE(treeItem, 0);
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
|
@ -377,7 +378,7 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIDOMNode *aDocNode)
|
|||
// This also works for firing events for error pages
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
GetDocShellTreeItemFor(aDocNode);
|
||||
nsAccUtils::GetDocShellTreeItemFor(aDocNode);
|
||||
NS_ASSERTION(treeItem, "No docshelltreeitem for aDocNode");
|
||||
if (!treeItem) {
|
||||
return;
|
||||
|
@ -975,7 +976,8 @@ NS_IMETHODIMP nsRootAccessible::GetAccessibleRelated(PRUint32 aRelationType,
|
|||
return nsDocAccessibleWrap::GetAccessibleRelated(aRelationType, aRelated);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> contentTreeItem = GetContentDocShell(treeItem);
|
||||
// there may be no content area, so we need a null check
|
||||
if (contentTreeItem) {
|
||||
|
@ -996,7 +998,7 @@ NS_IMETHODIMP nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsAccessNode::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
NS_ASSERTION(docShellTreeItem, "No doc shell tree item for document");
|
||||
NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
|
||||
PRInt32 contentType;
|
||||
|
|
|
@ -242,6 +242,11 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
|
|||
{
|
||||
nsIntRect screenRect;
|
||||
NS_ENSURE_TRUE(aFrame, screenRect);
|
||||
if (aFrame->GetType() != nsAccessibilityAtoms::textFrame) {
|
||||
// XXX fallback for non-text frames, happens for bullets right now
|
||||
// but in the future bullets will have proper text frames
|
||||
return aFrame->GetScreenRectExternal();
|
||||
}
|
||||
|
||||
PRInt32 startContentOffset, endContentOffset;
|
||||
nsresult rv = RenderedToContentOffset(aFrame, aStartRenderedOffset, &startContentOffset);
|
||||
|
@ -364,17 +369,20 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
|
|||
if (IsText(accessible)) {
|
||||
// We only need info up to rendered offset -- that is what we're
|
||||
// converting to content offset
|
||||
PRInt32 substringEndOffset;
|
||||
nsresult rv = frame->GetRenderedText(nsnull, &skipChars, &iter);
|
||||
PRUint32 ourRenderedStart = iter.GetSkippedOffset();
|
||||
PRInt32 ourContentStart = iter.GetOriginalOffset();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
substringEndOffset =
|
||||
iter.ConvertOriginalToSkipped(skipChars.GetOriginalCharCount() +
|
||||
ourContentStart) -
|
||||
ourRenderedStart;
|
||||
PRInt32 substringEndOffset = -1;
|
||||
PRUint32 ourRenderedStart = 0;
|
||||
PRInt32 ourContentStart = 0;
|
||||
if (frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
nsresult rv = frame->GetRenderedText(nsnull, &skipChars, &iter);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
ourRenderedStart = iter.GetSkippedOffset();
|
||||
ourContentStart = iter.GetOriginalOffset();
|
||||
substringEndOffset =
|
||||
iter.ConvertOriginalToSkipped(skipChars.GetOriginalCharCount() +
|
||||
ourContentStart) - ourRenderedStart;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (substringEndOffset < 0) {
|
||||
// XXX for non-textframe text like list bullets,
|
||||
// should go away after list bullet rewrite
|
||||
substringEndOffset = TextLength(accessible);
|
||||
|
@ -385,8 +393,14 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
|
|||
// We don't want the whole string for this accessible
|
||||
// Get out the continuing text frame with this offset
|
||||
PRInt32 outStartLineUnused;
|
||||
PRInt32 contentOffset = iter.ConvertSkippedToOriginal(startOffset) +
|
||||
ourRenderedStart - ourContentStart;
|
||||
PRInt32 contentOffset;
|
||||
if (frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
contentOffset = iter.ConvertSkippedToOriginal(startOffset) +
|
||||
ourRenderedStart - ourContentStart;
|
||||
}
|
||||
else {
|
||||
contentOffset = startOffset;
|
||||
}
|
||||
frame->GetChildFrameContainingOffset(contentOffset, PR_TRUE,
|
||||
&outStartLineUnused, &frame);
|
||||
if (aEndFrame) {
|
||||
|
@ -654,9 +668,10 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
|
|||
|
||||
nsIFrame *frame = accessNode->GetFrame();
|
||||
NS_ENSURE_TRUE(frame, -1);
|
||||
|
||||
rv = RenderedToContentOffset(frame, aFromOffset, &contentOffset);
|
||||
NS_ENSURE_SUCCESS(rv, -1);
|
||||
if (frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
rv = RenderedToContentOffset(frame, aFromOffset, &contentOffset);
|
||||
NS_ENSURE_SUCCESS(rv, -1);
|
||||
}
|
||||
}
|
||||
|
||||
pos.SetData(aAmount, aDirection, contentOffset,
|
||||
|
@ -1089,7 +1104,7 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
nsSize frameSize = frame->GetSize();
|
||||
if (pointInFrame.x < frameSize.width && pointInFrame.y < frameSize.height) {
|
||||
// Finished
|
||||
if (IsText(accessible)) {
|
||||
if (frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
nsIFrame::ContentOffsets contentOffsets = frame->GetContentOffsetsFromPointExternal(pointInFrame, PR_TRUE);
|
||||
if (contentOffsets.IsNull() || contentOffsets.content != content) {
|
||||
return NS_OK; // Not found, will return -1
|
||||
|
@ -1265,10 +1280,24 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
|||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
if (!content->HasFlag(NODE_IS_EDITABLE)) {
|
||||
// If we're inside an editable container, then return that container's editor
|
||||
nsCOMPtr<nsIAccessible> ancestor, current = this;
|
||||
while (NS_SUCCEEDED(current->GetParent(getter_AddRefs(ancestor))) && ancestor) {
|
||||
nsRefPtr<nsHyperTextAccessible> ancestorTextAccessible;
|
||||
ancestor->QueryInterface(NS_GET_IID(nsHyperTextAccessible),
|
||||
getter_AddRefs(ancestorTextAccessible));
|
||||
if (ancestorTextAccessible) {
|
||||
// Recursion will stop at container doc because it has its own impl
|
||||
// of GetAssociatedEditor()
|
||||
return ancestorTextAccessible->GetAssociatedEditor(aEditor);
|
||||
}
|
||||
current = ancestor;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
|
||||
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
|
||||
if (!editingSession)
|
||||
return NS_OK; // No editing session interface
|
||||
|
@ -1479,15 +1508,26 @@ NS_IMETHODIMP nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum, P
|
|||
nsIFrame *startFrame = GetPosAndText(aStartOffset, aEndOffset, nsnull, &endFrame);
|
||||
NS_ENSURE_TRUE(startFrame, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
|
||||
nsIContent *startParentContent = startFrame->GetContent();
|
||||
PRInt32 startOffset;
|
||||
if (startFrame->GetType() != nsAccessibilityAtoms::textFrame) {
|
||||
nsIContent *newParent = startParentContent->GetParent();
|
||||
aStartOffset = newParent->IndexOf(startParentContent);
|
||||
startOffset = newParent->IndexOf(startParentContent);
|
||||
startParentContent = newParent;
|
||||
}
|
||||
else {
|
||||
// We have a rendered offset into the text frame, and it needs to be
|
||||
// a content offset for us to set the caret
|
||||
nsIFrame *startPrimaryFrame =
|
||||
shell->GetPrimaryFrameFor(startFrame->GetContent());
|
||||
rv = RenderedToContentOffset(startPrimaryFrame, aStartOffset, &startOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> startParentNode(do_QueryInterface(startParentContent));
|
||||
NS_ENSURE_TRUE(startParentNode, NS_ERROR_FAILURE);
|
||||
rv = range->SetStart(startParentNode, aStartOffset);
|
||||
rv = range->SetStart(startParentNode, startOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isOnlyCaret) {
|
||||
|
@ -1496,14 +1536,23 @@ NS_IMETHODIMP nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum, P
|
|||
}
|
||||
else {
|
||||
nsIContent *endParentContent = endFrame->GetContent();
|
||||
PRInt32 endOffset;
|
||||
if (endFrame->GetType() != nsAccessibilityAtoms::textFrame) {
|
||||
nsIContent *newParent = endParentContent->GetParent();
|
||||
aEndOffset = newParent->IndexOf(endParentContent);
|
||||
endOffset = newParent->IndexOf(endParentContent);
|
||||
endParentContent = newParent;
|
||||
}
|
||||
else {
|
||||
// We have a rendered offset into the text frame, and it needs to be
|
||||
// a content offset for us to set the caret
|
||||
nsIFrame *endPrimaryFrame =
|
||||
shell->GetPrimaryFrameFor(endFrame->GetContent());
|
||||
rv = RenderedToContentOffset(endPrimaryFrame, aEndOffset, &endOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> endParentNode(do_QueryInterface(endParentContent));
|
||||
NS_ENSURE_TRUE(endParentNode, NS_ERROR_FAILURE);
|
||||
rv = range->SetEnd(endParentNode, aEndOffset);
|
||||
rv = range->SetEnd(endParentNode, endOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -1564,8 +1613,7 @@ nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
|
|||
nsCOMPtr<nsIDOMNode> startNode;
|
||||
nsCOMPtr<nsIContent> startContent(startFrame->GetContent());
|
||||
|
||||
PRBool isStartAccText = IsText(startAcc);
|
||||
if (isStartAccText) {
|
||||
if (startFrame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
nsresult rv = RenderedToContentOffset(startFrame, startOffset,
|
||||
&startOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1581,8 +1629,7 @@ nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
|
|||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
nsCOMPtr<nsIContent> endContent(endFrame->GetContent());
|
||||
|
||||
PRBool isEndAccText = IsText(endAcc);
|
||||
if (isEndAccText) {
|
||||
if (endFrame->GetType() == nsAccessibilityAtoms::textFrame) {
|
||||
nsresult rv = RenderedToContentOffset(endFrame, endOffset,
|
||||
&endOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1602,6 +1649,11 @@ nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
|
|||
nsresult nsHyperTextAccessible::ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
|
||||
PRUint32 *aRenderedOffset)
|
||||
{
|
||||
NS_ASSERTION(aFrame->GetType() == nsAccessibilityAtoms::textFrame,
|
||||
"Need text frame for offset conversion");
|
||||
NS_ASSERTION(aFrame->GetPrevContinuation() == nsnull,
|
||||
"Call on primary frame only");
|
||||
|
||||
gfxSkipChars skipChars;
|
||||
gfxSkipCharsIterator iter;
|
||||
// Only get info up to original ofset, we know that will be larger than skipped offset
|
||||
|
@ -1620,6 +1672,11 @@ nsresult nsHyperTextAccessible::ContentToRenderedOffset(nsIFrame *aFrame, PRInt3
|
|||
nsresult nsHyperTextAccessible::RenderedToContentOffset(nsIFrame *aFrame, PRUint32 aRenderedOffset,
|
||||
PRInt32 *aContentOffset)
|
||||
{
|
||||
NS_ASSERTION(aFrame->GetType() == nsAccessibilityAtoms::textFrame,
|
||||
"Need text frame for offset conversion");
|
||||
NS_ASSERTION(aFrame->GetPrevContinuation() == nsnull,
|
||||
"Call on primary frame only");
|
||||
|
||||
gfxSkipChars skipChars;
|
||||
gfxSkipCharsIterator iter;
|
||||
// We only need info up to skipped offset -- that is what we're converting to original offset
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include "nsPIDOMWindow.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "AccessibleApplication.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
|
||||
/// the accessible library and cached methods
|
||||
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
|
||||
|
@ -126,6 +128,34 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
{
|
||||
// Can get to IAccessibleApplication from any node via QS
|
||||
if (iid == IID_IAccessibleApplication) {
|
||||
nsRefPtr<nsApplicationAccessibleWrap> app =
|
||||
GetApplicationAccessible();
|
||||
nsresult rv = app->QueryNativeInterface(iid, ppv);
|
||||
return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get an ISimpleDOMNode, ISimpleDOMDocument, ISimpleDOMText
|
||||
* or any IAccessible2 interface on should use IServiceProvider like this:
|
||||
* -----------------------------------------------------------------------
|
||||
* ISimpleDOMDocument *pAccDoc = NULL;
|
||||
* IServiceProvider *pServProv = NULL;
|
||||
* pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv);
|
||||
* if (pServProv) {
|
||||
* const GUID unused;
|
||||
* pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc);
|
||||
* pServProv->Release();
|
||||
* }
|
||||
*/
|
||||
|
||||
return QueryInterface(iid, ppv);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// ISimpleDOMNode methods
|
||||
//-----------------------------------------------------
|
||||
|
|
|
@ -61,12 +61,16 @@ typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREAD
|
|||
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
public ISimpleDOMNode
|
||||
public ISimpleDOMNode,
|
||||
public IServiceProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWINACCESSNODE
|
||||
|
||||
public: // IServiceProvider
|
||||
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
|
|
@ -1005,27 +1005,6 @@ STDMETHODIMP nsAccessibleWrap::put_accValue(
|
|||
|
||||
#include "mshtml.h"
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
{
|
||||
/**
|
||||
* To get an ISimpleDOMNode, ISimpleDOMDocument or ISimpleDOMText
|
||||
* from an IAccessible you have to use IServiceProvider like this:
|
||||
* --------------------------------------------------------------
|
||||
* ISimpleDOMDocument *pAccDoc = NULL;
|
||||
* IServiceProvider *pServProv = NULL;
|
||||
* pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv);
|
||||
* if (pServProv) {
|
||||
* const GUID unused;
|
||||
* pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc);
|
||||
* pServProv->Release();
|
||||
* }
|
||||
*/
|
||||
|
||||
return QueryInterface(iid, ppv);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR* aNumElementsFetched)
|
||||
{
|
||||
|
|
|
@ -94,8 +94,7 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
public CAccessibleHyperlink,
|
||||
public CAccessibleValue,
|
||||
public IAccessible2,
|
||||
public IEnumVARIANT,
|
||||
public IServiceProvider
|
||||
public IEnumVARIANT
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||
|
@ -107,9 +106,6 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
public: // IUnknown methods - see iunknown.h for documentation
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
public: // IServiceProvider
|
||||
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||
|
||||
// Return the registered OLE class ID of this object's CfDataObj.
|
||||
CLSID GetClassID() const;
|
||||
|
||||
|
|
|
@ -319,6 +319,42 @@ NS_IMETHODIMP nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessible::getChildAtPoint(in long x, in long y)
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
|
||||
|
||||
nsIFrame *rootFrame = presShell->GetRootFrame();
|
||||
NS_ENSURE_STATE(rootFrame);
|
||||
|
||||
nsIntRect rootRect = rootFrame->GetScreenRectExternal();
|
||||
|
||||
PRInt32 clientX = presContext->AppUnitsToIntCSSPixels(
|
||||
presContext->DevPixelsToAppUnits(aX - rootRect.x));
|
||||
PRInt32 clientY = presContext->AppUnitsToIntCSSPixels(
|
||||
presContext->DevPixelsToAppUnits(aY - rootRect.y));
|
||||
|
||||
PRInt32 row = -1;
|
||||
nsCOMPtr<nsITreeColumn> column;
|
||||
nsCAutoString childEltUnused;
|
||||
mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
|
||||
childEltUnused);
|
||||
|
||||
// If we failed to find tree cell for the given point then it might be
|
||||
// tree columns.
|
||||
if (row == -1 || !column)
|
||||
return nsXULSelectableAccessible::GetChildAtPoint(aX, aY, aAccessible);
|
||||
|
||||
return GetCachedTreeitemAccessible(row, column, aAccessible);
|
||||
}
|
||||
|
||||
// Ask treeselection to get all selected children
|
||||
NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsIArray **_retval)
|
||||
{
|
||||
|
@ -598,18 +634,11 @@ nsXULTreeitemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsIAccessibleStates::STATE_SELECTABLE;
|
||||
|
||||
// get expanded/collapsed state
|
||||
PRBool isContainer, isContainerOpen, isContainerEmpty;
|
||||
mTreeView->IsContainer(mRow, &isContainer);
|
||||
if (isContainer) {
|
||||
mTreeView->IsContainerEmpty(mRow, &isContainerEmpty);
|
||||
if (!isContainerEmpty) {
|
||||
if (aExtraState)
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EXPANDABLE;
|
||||
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
*aState |= isContainerOpen? PRUint32(nsIAccessibleStates::STATE_EXPANDED):
|
||||
PRUint32(nsIAccessibleStates::STATE_COLLAPSED);
|
||||
}
|
||||
if (IsExpandable()) {
|
||||
PRBool isContainerOpen;
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
*aState |= isContainerOpen? PRUint32(nsIAccessibleStates::STATE_EXPANDED):
|
||||
PRUint32(nsIAccessibleStates::STATE_COLLAPSED);
|
||||
}
|
||||
|
||||
// get selected state
|
||||
|
@ -653,17 +682,31 @@ nsXULTreeitemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// "activate" (xor "cycle") action is available for all treeitems
|
||||
// "expand/collapse" action is avaible for treeitem which is container
|
||||
NS_IMETHODIMP nsXULTreeitemAccessible::GetNumActions(PRUint8 *_retval)
|
||||
PRBool nsXULTreeitemAccessible::IsExpandable()
|
||||
{
|
||||
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mTree && mTreeView && mColumn, NS_ERROR_FAILURE);
|
||||
PRBool isContainer;
|
||||
mTreeView->IsContainer(mRow, &isContainer);
|
||||
if (isContainer)
|
||||
*_retval = 2;
|
||||
else
|
||||
*_retval = 1;
|
||||
if (isContainer) {
|
||||
PRBool isEmpty;
|
||||
mTreeView->IsContainerEmpty(mRow, &isEmpty);
|
||||
if (!isEmpty) {
|
||||
PRBool isPrimary;
|
||||
mColumn->GetPrimary(&isPrimary);
|
||||
if (isPrimary) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// "activate" (xor "cycle") action is available for all treeitems
|
||||
// "expand/collapse" action is avaible for treeitem which is container
|
||||
NS_IMETHODIMP nsXULTreeitemAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTree && mTreeView && mColumn, NS_ERROR_FAILURE);
|
||||
*aNumActions = IsExpandable() ? 2 : 1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -684,17 +727,13 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIndex == eAction_Expand) {
|
||||
PRBool isContainer, isContainerOpen;
|
||||
mTreeView->IsContainer(mRow, &isContainer);
|
||||
if (isContainer) {
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
if (isContainerOpen)
|
||||
aName.AssignLiteral("collapse");
|
||||
else
|
||||
aName.AssignLiteral("expand");
|
||||
}
|
||||
|
||||
else if (aIndex == eAction_Expand && IsExpandable()) {
|
||||
PRBool isContainerOpen;
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
if (isContainerOpen)
|
||||
aName.AssignLiteral("collapse");
|
||||
else
|
||||
aName.AssignLiteral("expand");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -884,11 +923,8 @@ NS_IMETHODIMP nsXULTreeitemAccessible::DoAction(PRUint8 index)
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
else if (index == eAction_Expand) {
|
||||
PRBool isContainer;
|
||||
mTreeView->IsContainer(mRow, &isContainer);
|
||||
if (isContainer)
|
||||
return mTreeView->ToggleOpenState(mRow);
|
||||
else if (index == eAction_Expand && IsExpandable()) {
|
||||
return mTreeView->ToggleOpenState(mRow);
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible);
|
||||
|
||||
static void GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
|
||||
static nsresult GetColumnCount(nsITreeBoxObject* aBoxObject, PRInt32 *aCount);
|
||||
|
@ -126,6 +128,7 @@ public:
|
|||
NS_IMETHOD GetUniqueID(void **aUniqueID);
|
||||
|
||||
protected:
|
||||
PRBool IsExpandable();
|
||||
nsCOMPtr<nsITreeBoxObject> mTree;
|
||||
nsCOMPtr<nsITreeView> mTreeView;
|
||||
PRInt32 mRow;
|
||||
|
|
|
@ -341,9 +341,6 @@ pref("network.cookie.enableForCurrentSessionOnly", false);
|
|||
|
||||
// l12n and i18n
|
||||
pref("intl.accept_languages", "chrome://global/locale/intl.properties");
|
||||
// collationOption is only set on linux for japanese. see bug 18338 and 62015
|
||||
// we need to check if this pref is still useful.
|
||||
pref("intl.collationOption", "chrome://global-platform/locale/intl.properties");
|
||||
pref("intl.charsetmenu.browser.static", "chrome://global/locale/intl.properties");
|
||||
pref("intl.charsetmenu.browser.more1", "chrome://global/locale/intl.properties");
|
||||
pref("intl.charsetmenu.browser.more2", "chrome://global/locale/intl.properties");
|
||||
|
@ -499,6 +496,20 @@ pref("browser.contentHandlers.types.5.type", "application/vnd.mozilla.maybe.feed
|
|||
|
||||
pref("browser.feeds.handler", "ask");
|
||||
|
||||
// For now, this is living in content rather than in locales, as per Pike.
|
||||
// Eventually it will get merged into region.properties; see bug 395277.
|
||||
//
|
||||
// At startup, if the handler service notices that the version number here
|
||||
// is newer than the version number in the handler service datastore, it will
|
||||
// add any handlers it finds in the prefs (as seeded by this file) to its
|
||||
// datastore.
|
||||
pref("gecko.handlerService.defaultHandlersVersion", "0");
|
||||
//
|
||||
// The default set of web-based protocol handlers shown in the application
|
||||
// selection dialog
|
||||
pref("gecko.handlerService.schemes.webcal.0.name", "WebCal Test Handler");
|
||||
pref("gecko.handlerService.schemes.webcal.0.uriTemplate", "http://handler-test.mozilla.org/webcal?url=%s");
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
// Safe browsing does nothing unless both these prefs are set.
|
||||
pref("browser.safebrowsing.enabled", true);
|
||||
|
|
|
@ -45,6 +45,20 @@
|
|||
margin: 1em 0px 10px 17px;
|
||||
}
|
||||
|
||||
#distribution {
|
||||
font-weight: bold;
|
||||
color: #909090;
|
||||
display: none;
|
||||
margin: 0em 0px 0px 17px;
|
||||
}
|
||||
|
||||
#distributionId {
|
||||
font-weight: bold;
|
||||
color: #909090;
|
||||
display: none;
|
||||
margin: 0em 0px 10px 17px;
|
||||
}
|
||||
|
||||
#copyright {
|
||||
margin: 0px 0px 3px 16px;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,29 @@ function init(aEvent)
|
|||
{
|
||||
if (aEvent.target != document)
|
||||
return;
|
||||
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
try {
|
||||
var distroId = prefs.getCharPref("distribution.id");
|
||||
if (distroId) {
|
||||
var distroVersion = prefs.getCharPref("distribution.version");
|
||||
var distroAbout = prefs.getComplexValue("distribution.about", Ci.nsISupportsString);
|
||||
|
||||
var distroField = document.getElementById("distribution");
|
||||
distroField.value = distroAbout;
|
||||
distroField.style.display = "block";
|
||||
|
||||
var distroIdField = document.getElementById("distributionId");
|
||||
distroIdField.value = distroId + " - " + distroVersion;
|
||||
distroIdField.style.display = "block";
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// Pref is unset
|
||||
}
|
||||
|
||||
var userAgentField = document.getElementById("userAgent");
|
||||
userAgentField.value = navigator.userAgent;
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@
|
|||
<deck id="modes" flex="1">
|
||||
<vbox flex="1" id="clientBox">
|
||||
#expand <label id="version" value="&aboutVersion; __MOZ_APP_VERSION__"/>
|
||||
<label id="distribution"/>
|
||||
<label id="distributionId"/>
|
||||
<description id="copyright">©rightText;</description>
|
||||
<textbox id="userAgent" multiline="true" readonly="true"/>
|
||||
</vbox>
|
||||
|
|
|
@ -771,7 +771,8 @@ var PlacesStarButton = {
|
|||
return;
|
||||
|
||||
var uri = getBrowser().currentURI;
|
||||
this._starred = uri && (PlacesUtils.getMostRecentBookmarkForURI(uri) != -1);
|
||||
this._starred = uri && (PlacesUtils.getMostRecentBookmarkForURI(uri) != -1 ||
|
||||
PlacesUtils.getMostRecentFolderForFeedURI(uri) != -1);
|
||||
if (this._starred)
|
||||
starIcon.setAttribute("starred", "true");
|
||||
else
|
||||
|
|
|
@ -3024,23 +3024,13 @@ function BrowserCustomizeToolbar()
|
|||
cmd.setAttribute("disabled", "true");
|
||||
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
document.getElementById("customizeToolbarSheetBox").hidden = false;
|
||||
|
||||
/**
|
||||
* XXXmano hack: when a new tab is added while the sheet is visible,
|
||||
* the new tabpanel is overlaying the sheet. We workaround this issue by
|
||||
* hiding and reopening the sheet when a new tab is added.
|
||||
*/
|
||||
function TabOpenSheetHandler(aEvent) {
|
||||
getBrowser().removeEventListener("TabOpen", TabOpenSheetHandler, false);
|
||||
|
||||
document.getElementById("customizeToolbarSheetIFrame")
|
||||
.contentWindow.gCustomizeToolbarSheet.done();
|
||||
document.getElementById("customizeToolbarSheetBox").hidden = true;
|
||||
BrowserCustomizeToolbar();
|
||||
|
||||
}
|
||||
getBrowser().addEventListener("TabOpen", TabOpenSheetHandler, false);
|
||||
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
|
||||
sheetFrame.hidden = false;
|
||||
// XXXmano: there's apparently no better way to get this when the iframe is
|
||||
// hidden
|
||||
var sheetWidth = sheetFrame.style.width.match(/([0-9]+)px/)[1];
|
||||
document.getElementById("customizeToolbarSheetPopup")
|
||||
.openPopup(getNavToolbox(), "after_start", (window.innerWidth - sheetWidth) / 2, 0);
|
||||
#else
|
||||
window.openDialog("chrome://global/content/customizeToolbar.xul",
|
||||
"CustomizeToolbar",
|
||||
|
@ -3052,7 +3042,8 @@ function BrowserCustomizeToolbar()
|
|||
function BrowserToolboxCustomizeDone(aToolboxChanged)
|
||||
{
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
document.getElementById("customizeToolbarSheetBox").hidden = true;
|
||||
document.getElementById("customizeToolbarSheetIFrame").hidden = true;
|
||||
document.getElementById("customizeToolbarSheetPopup").hidePopup();
|
||||
#endif
|
||||
|
||||
// Update global UI elements that may have been added or removed
|
||||
|
@ -3698,9 +3689,8 @@ nsBrowserStatusHandler.prototype =
|
|||
|
||||
var securityUI = gBrowser.securityUI;
|
||||
this.securityButton.setAttribute("tooltiptext", securityUI.tooltipText);
|
||||
var lockIcon = document.getElementById("lock-icon");
|
||||
if (lockIcon)
|
||||
lockIcon.setAttribute("tooltiptext", securityUI.tooltipText);
|
||||
|
||||
getIdentityHandler().checkIdentity(aWebProgress, aRequest, aState);
|
||||
},
|
||||
|
||||
// simulate all change notifications after switching tabs
|
||||
|
@ -5583,3 +5573,201 @@ function showToolbars() {
|
|||
|
||||
return false; // Dismiss the notification message
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility class to handle manipulations of the identity indicators in the UI
|
||||
*/
|
||||
function IdentityHandler() {}
|
||||
|
||||
IdentityHandler.prototype = {
|
||||
|
||||
// Mode strings used to control CSS display
|
||||
IDENTITY_MODE_IDENTIFIED : "verifiedIdentity", // High-quality identity information
|
||||
IDENTITY_MODE_DOMAIN_VERIFIED : "verifiedDomain", // Minimal SSL CA-signed domain verification
|
||||
IDENTITY_MODE_UNKNOWN : "unknownIdentity", // No trusted identity information
|
||||
|
||||
// Cache the most recently seen SSLStatus and URI to prevent unnecessary updates
|
||||
_lastStatus : null,
|
||||
_lastURI : null,
|
||||
|
||||
/**
|
||||
* Handler for mouseclicks on the "Tell me more about this website" link text
|
||||
* in the "identity-popup" panel.
|
||||
*/
|
||||
handleMoreInfoClick : function(event) {
|
||||
if (event.button == 0) {
|
||||
displaySecurityInfo();
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine the identity of the page being displayed by examining its SSL cert
|
||||
* (if available) and, if necessary, update the UI to reflect this. Intended to
|
||||
* be called by an nsIWebProgressListener.
|
||||
*
|
||||
* @param nsIWebProgress webProgress
|
||||
* @param nsIRequest request
|
||||
* @param PRUint32 state
|
||||
*/
|
||||
checkIdentity : function(webProgress, request, state) {
|
||||
var currentStatus = gBrowser.securityUI
|
||||
.QueryInterface(Components.interfaces.nsISSLStatusProvider)
|
||||
.SSLStatus;
|
||||
var currentURI = gBrowser.currentURI;
|
||||
if (currentStatus == this._lastStatus && currentURI == this._lastURI) {
|
||||
// No need to update, this is a no-op check
|
||||
return;
|
||||
}
|
||||
|
||||
this._lastStatus = currentStatus;
|
||||
this._lastURI = currentURI;
|
||||
|
||||
if (state & Components.interfaces.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
|
||||
this.setMode(this.IDENTITY_MODE_IDENTIFIED);
|
||||
else if (state & Components.interfaces.nsIWebProgressListener.STATE_SECURE_HIGH)
|
||||
this.setMode(this.IDENTITY_MODE_DOMAIN_VERIFIED);
|
||||
else
|
||||
this.setMode(this.IDENTITY_MODE_UNKNOWN);
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the UI to reflect the specified mode, which should be one of the
|
||||
* IDENTITY_MODE_* constants.
|
||||
*/
|
||||
setMode : function(newMode) {
|
||||
document.getElementById("identity-popup").className = newMode;
|
||||
document.getElementById("identity-box").className = newMode;
|
||||
document.getElementById("identity-popup-content-box").className = newMode;
|
||||
this.setMessages(newMode);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up the title and content messages for the identity message bubble, and
|
||||
* primary UI based on the specified mode, and the details of the SSL cert, where
|
||||
* applicable
|
||||
*
|
||||
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
|
||||
*/
|
||||
setMessages : function(newMode) {
|
||||
|
||||
var stringBundle = document.getElementById("bundle_browser");
|
||||
|
||||
// Initialize the optional strings to empty values
|
||||
var supplemental = "";
|
||||
var verifier = "";
|
||||
|
||||
if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
|
||||
var title = stringBundle.getString("identity.domainverified.title");
|
||||
var encryption_label = stringBundle.getString("identity.encrypted");
|
||||
var status = this._lastStatus.QueryInterface(Components.interfaces.nsISSLStatus);
|
||||
var cert = status.serverCert;
|
||||
|
||||
// It would be sort of nice to use the CN= field in the cert, since that's
|
||||
// typically what we want here, but thanks to x509 certs being extensible,
|
||||
// it's not the only place you have to check, there can be more than one domain,
|
||||
// et cetera, ad nauseum. We know the cert is valid for location.host, so
|
||||
// let's just use that, it's what the status bar does too.
|
||||
var body = this._lastURI.host;
|
||||
var caOrg = cert.issuerOrganization || cert.issuerCommonName;
|
||||
verifier = stringBundle.getFormattedString("identity.identified.verifier",
|
||||
[caOrg]);
|
||||
supplemental = stringBundle.getString("identity.domainverified.supplemental");
|
||||
|
||||
var icon_label = body;
|
||||
var tooltip = verifier;
|
||||
}
|
||||
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
|
||||
title = stringBundle.getString("identity.identified.title");
|
||||
encryption_label = stringBundle.getString("identity.encrypted");
|
||||
|
||||
// If it's identified, then we can populate the dialog with credentials
|
||||
status = this._lastStatus.QueryInterface(Components.interfaces.nsISSLStatus);
|
||||
cert = status.serverCert;
|
||||
|
||||
// Pull the basics out with fallback options in case common
|
||||
// (optional) fields are left blank
|
||||
body = cert.organization || cert.commonName;
|
||||
caOrg = cert.issuerOrganization || cert.issuerCommonName;
|
||||
verifier = tooltip = stringBundle.getFormattedString("identity.identified.verifier",
|
||||
[caOrg]);
|
||||
|
||||
// Now try to extract out supplemental location fields and append
|
||||
// them, where available. subjectName is a comma-delimited list of
|
||||
// key=value pairs.
|
||||
if (cert.subjectName) {
|
||||
var subjectNameFields = {};
|
||||
cert.subjectName.split(",").forEach(function(v) {
|
||||
var field = v.split("=");
|
||||
this[field[0]] = field[1];
|
||||
}, subjectNameFields);
|
||||
|
||||
if (subjectNameFields.L) // City
|
||||
supplemental += subjectNameFields.L + "\n";
|
||||
|
||||
if (subjectNameFields.ST && subjectNameFields.C) // State and Country
|
||||
supplemental += stringBundle.getFormattedString("identity.identified.state_and_country",
|
||||
[subjectNameFields.ST,
|
||||
subjectNameFields.C]);
|
||||
else if (subjectNameFields.ST) // State only
|
||||
supplemental += subjectNameFields.ST;
|
||||
else if (subjectNameFields.C) // Country only
|
||||
supplemental += subjectNameFields.C;
|
||||
|
||||
// Include country code in top-level label, if we have one
|
||||
if (subjectNameFields.C)
|
||||
icon_label = stringBundle.getFormattedString("identity.identified.title_with_country",
|
||||
[body, subjectNameFields.C]);
|
||||
else
|
||||
icon_label = body;
|
||||
}
|
||||
}
|
||||
else {
|
||||
encryption_label = stringBundle.getString("identity.unencrypted");
|
||||
title = stringBundle.getString("identity.unknown.title");
|
||||
body = stringBundle.getString("identity.unknown.body");
|
||||
icon_label = "";
|
||||
tooltip = body;
|
||||
}
|
||||
|
||||
// Push the appropriate strings out to the UI
|
||||
document.getElementById("identity-popup-title").value = title;
|
||||
document.getElementById("identity-popup-content").textContent = body;
|
||||
document.getElementById("identity-popup-content-supplemental")
|
||||
.textContent = supplemental;
|
||||
document.getElementById("identity-popup-content-verifier")
|
||||
.textContent = verifier;
|
||||
document.getElementById("identity-popup-encryption-label")
|
||||
.textContent = encryption_label;
|
||||
document.getElementById("identity-box").tooltipText = tooltip;
|
||||
document.getElementById("identity-icon-label").value = icon_label;
|
||||
},
|
||||
|
||||
/**
|
||||
* Click handler for the identity-box element in primary chrome.
|
||||
*/
|
||||
handleMouseUp : function(event) {
|
||||
if (event.button != 0)
|
||||
return; // We only want left-clicks
|
||||
|
||||
// Make sure that the display:none style we set in xul is removed now that
|
||||
// the popup is actually needed
|
||||
var popup = document.getElementById('identity-popup');
|
||||
popup.hidden = false;
|
||||
|
||||
// Now open the popup, anchored off the primary chrome element
|
||||
popup.openPopup(document.getElementById('identity-box'), 'after_start');
|
||||
}
|
||||
};
|
||||
|
||||
var gIdentityHandler;
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of the identity handler class. Should always be
|
||||
* used instead of referencing the global variable directly or creating new instances
|
||||
*/
|
||||
function getIdentityHandler() {
|
||||
if (!gIdentityHandler)
|
||||
gIdentityHandler = new IdentityHandler();
|
||||
return gIdentityHandler;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
# Joe Hewitt <hewitt@netscape.com>
|
||||
# Pierre Chanial <chanial@noos.fr>
|
||||
# Dean Tessman <dean_tessman@hotmail.com>
|
||||
# Johnathan Nightingale <johnath@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -136,6 +137,34 @@
|
|||
|
||||
<popup id="placesContext"/>
|
||||
|
||||
<!-- Popup for site identity information -->
|
||||
<panel id="identity-popup" position="after_start" hidden="true">
|
||||
<hbox id="identity-popup-container" align="top">
|
||||
<image id="identity-popup-icon"/>
|
||||
<vbox id="identity-popup-content-box">
|
||||
<!-- Title Bar -->
|
||||
<label id="identity-popup-title"/>
|
||||
<!-- Content area -->
|
||||
<description id="identity-popup-content"/>
|
||||
<description id="identity-popup-content-supplemental"/>
|
||||
<description id="identity-popup-content-verifier"/>
|
||||
<hbox id="identity-popup-encryption" flex="1">
|
||||
<vbox>
|
||||
<image id="identity-popup-encryption-icon"/>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<description id="identity-popup-encryption-label" flex="1"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<!-- Footer link to page info -->
|
||||
<label id="identity-popup-more-info-link"
|
||||
class="text-link plain"
|
||||
value="&identity.moreInfoLinkText;"
|
||||
onclick="getIdentityHandler().handleMoreInfoClick(event);"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</panel>
|
||||
|
||||
<tooltip id="urlTooltip">
|
||||
<label crop="center" flex="1"/>
|
||||
</tooltip>
|
||||
|
@ -231,19 +260,25 @@
|
|||
oninput="gBrowser.userTypedValue = this.value"
|
||||
ontextentered="return handleURLBarCommand(param);"
|
||||
ontextreverted="return handleURLBarRevert();">
|
||||
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
|
||||
<image id="page-proxy-button"
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
<image id="page-proxy-favicon" validate="never"
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
onload="this.parentNode.selectedIndex = 1;
|
||||
event.stopPropagation();"
|
||||
onerror="gBrowser.addToMissedIconCache(this.src);
|
||||
this.removeAttribute('src');
|
||||
this.parentNode.selectedIndex = 0;"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
</deck>
|
||||
<!-- Use onmouseup instead of normal popup= syntax since the popup
|
||||
code fires onmousedown, and hence eats our favicon drag events -->
|
||||
<box id="identity-box" align="center"
|
||||
onmouseup="getIdentityHandler().handleMouseUp(event);">
|
||||
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
|
||||
<image id="page-proxy-button"
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
<image id="page-proxy-favicon" validate="never"
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
onload="this.parentNode.selectedIndex = 1;
|
||||
event.stopPropagation();"
|
||||
onerror="gBrowser.addToMissedIconCache(this.src);
|
||||
this.removeAttribute('src');
|
||||
this.parentNode.selectedIndex = 0;"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
</deck>
|
||||
<label id="identity-icon-label"/>
|
||||
</box>
|
||||
<hbox id="urlbar-icons">
|
||||
<button type="menu"
|
||||
style="-moz-user-focus: none"
|
||||
|
@ -256,7 +291,6 @@
|
|||
oncommand="return FeedHandler.subscribeToFeed(null, event);"
|
||||
onclick="checkForMiddleClick(this, event);"/>
|
||||
</button>
|
||||
<image id="lock-icon" onclick="if (event.button == 0) displaySecurityInfo(); event.stopPropagation();"/>
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
<image id="safebrowsing-urlbar-icon" tooltiptext="&safeb.urlbaricon.tooltip;"
|
||||
level="safe"
|
||||
|
@ -414,42 +448,36 @@
|
|||
customizable="true"/>
|
||||
</toolbox>
|
||||
|
||||
<stack id="browser-stack" flex="1">
|
||||
<hbox flex="1" id="browser">
|
||||
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
|
||||
<sidebarheader align="center">
|
||||
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
|
||||
<image id="sidebar-throbber"/>
|
||||
<toolbarbutton class="tabs-closebutton" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
|
||||
</sidebarheader>
|
||||
<browser id="sidebar" flex="1" autoscroll="false"
|
||||
style="min-width: 14em; width: 18em; max-width: 36em;"/>
|
||||
</vbox>
|
||||
<hbox flex="1" id="browser">
|
||||
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
|
||||
<sidebarheader align="center">
|
||||
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
|
||||
<image id="sidebar-throbber"/>
|
||||
<toolbarbutton class="tabs-closebutton" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
|
||||
</sidebarheader>
|
||||
<browser id="sidebar" flex="1" autoscroll="false"
|
||||
style="min-width: 14em; width: 18em; max-width: 36em;"/>
|
||||
</vbox>
|
||||
|
||||
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" hidden="true"/>
|
||||
<vbox id="appcontent" flex="1">
|
||||
<tabbrowser id="content" disablehistory="true"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
onnewtab="BrowserOpenTab();"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
|
||||
onclick="return contentAreaClick(event, false);"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" hidden="true"/>
|
||||
<vbox id="appcontent" flex="1">
|
||||
<tabbrowser id="content" disablehistory="true"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
onnewtab="BrowserOpenTab();"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
|
||||
onclick="return contentAreaClick(event, false);"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<hbox flex="1" hidden="true" id="customizeToolbarSheetBox">
|
||||
<hbox flex="1"/>
|
||||
<vbox flex="1">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"/>
|
||||
<vbox flex="1"/>
|
||||
</vbox>
|
||||
<hbox flex="1"/>
|
||||
</hbox>
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
#endif
|
||||
</stack>
|
||||
|
||||
<findbar browserid="content" id="FindToolbar"/>
|
||||
|
||||
|
|
|
@ -257,7 +257,6 @@
|
|||
<li>Pascal Chevrel</li>
|
||||
<li>Bob Clary</li>
|
||||
<li>Wil Clouser</li>
|
||||
<li>Stephen Colbert</li>
|
||||
<li>Mary Colvig</li>
|
||||
<li>Majken Connor</li>
|
||||
<li>Mike Connor</li>
|
||||
|
@ -483,6 +482,12 @@
|
|||
<p class="footnote">
|
||||
Gecko® is a registered trademark of Netscape Communications Corporation.</p>
|
||||
|
||||
<p class="footnote">
|
||||
Some image files in Mozilla Firefox® are from the
|
||||
<a href="" link="http://www.famfamfam.com/lab/icons/silk/" onclick="visitLink(event);">FAMFAMFAM Silk Icon Set</a>
|
||||
which is licensed under a
|
||||
<a href="" link="http://creativecommons.org/licenses/by/2.5/" onclick="visitLink(event);">Creative Commons Attribution 2.5 License</a>.</p>
|
||||
|
||||
<p class="footnote">
|
||||
U.S. GOVERNMENT END USERS. The Software is a “commercial item,”
|
||||
as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of
|
||||
|
@ -491,7 +496,7 @@
|
|||
Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through
|
||||
227.7202-4 (June 1995), all U.S. Government End Users acquire the
|
||||
Software with only those rights set forth herein.</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footerBox">
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<binding id="urlbar" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox class="autocomplete-textbox-container" flex="1">
|
||||
<children includes="image|deck|stack">
|
||||
<children includes="image|deck|stack|box">
|
||||
<xul:image class="autocomplete-icon" allowevents="true"/>
|
||||
</children>
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ EXTRA_PP_COMPONENTS = \
|
|||
nsBrowserGlue.js \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_JS_MODULES = distribution.js
|
||||
|
||||
DIRS = \
|
||||
dirprovider \
|
||||
microsummaries \
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
<menu id="helpMenu"/>
|
||||
</menubar>
|
||||
|
||||
<toolbar id="command-toolbar" tbalign="stretch" class="chromeclass-toolbar">
|
||||
<toolbar id="command-toolbar" class="chromeclass-toolbar">
|
||||
<toolbarbutton id="newbookmark" label="&menuitem.newBookmark.label;"
|
||||
accesskey="&menuitem.newBookmark.accesskey;"
|
||||
command="cmd_bm_newbookmark"/>
|
||||
|
|
|
@ -79,7 +79,6 @@ endif
|
|||
EXTRA_DSO_LDOPTS += \
|
||||
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
|
|
@ -200,6 +200,95 @@ AppendFileKey(const char *key, nsIProperties* aDirSvc,
|
|||
array.AppendObject(file);
|
||||
}
|
||||
|
||||
// Appends the distribution-specific search engine directories to the
|
||||
// array. The directory structure is as follows:
|
||||
|
||||
// appdir/
|
||||
// \- distribution/
|
||||
// \- searchplugins/
|
||||
// |- common/
|
||||
// \- locale/
|
||||
// |- <locale 1>/
|
||||
// ...
|
||||
// \- <locale N>/
|
||||
|
||||
// common engines are loaded for all locales. If there is no locale
|
||||
// directory for the current locale, there is a pref:
|
||||
// "distribution.searchplugins.defaultLocale"
|
||||
// which specifies a default locale to use.
|
||||
|
||||
static void
|
||||
AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)
|
||||
{
|
||||
nsCOMPtr<nsIFile> searchPlugins;
|
||||
nsresult rv = aDirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(searchPlugins));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
searchPlugins->AppendNative(NS_LITERAL_CSTRING("distribution"));
|
||||
searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins"));
|
||||
|
||||
PRBool exists;
|
||||
rv = searchPlugins->Exists(&exists);
|
||||
if (NS_FAILED(rv) || !exists)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIFile> commonPlugins;
|
||||
rv = searchPlugins->Clone(getter_AddRefs(commonPlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
commonPlugins->AppendNative(NS_LITERAL_CSTRING("common"));
|
||||
rv = commonPlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists)
|
||||
array.AppendObject(commonPlugins);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs) {
|
||||
|
||||
nsCOMPtr<nsIFile> localePlugins;
|
||||
rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
localePlugins->AppendNative(NS_LITERAL_CSTRING("locale"));
|
||||
|
||||
nsCString locale;
|
||||
rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(locale));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
nsCOMPtr<nsIFile> curLocalePlugins;
|
||||
rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
curLocalePlugins->AppendNative(locale);
|
||||
rv = curLocalePlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) {
|
||||
array.AppendObject(curLocalePlugins);
|
||||
return; // all done
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we didn't append the locale dir - try the default one
|
||||
nsCString defLocale;
|
||||
rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale",
|
||||
getter_Copies(defLocale));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
nsCOMPtr<nsIFile> defLocalePlugins;
|
||||
rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
defLocalePlugins->AppendNative(defLocale);
|
||||
rv = defLocalePlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists)
|
||||
array.AppendObject(defLocalePlugins);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
||||
nsISimpleEnumerator* *aResult)
|
||||
|
@ -214,6 +303,7 @@ nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
|||
|
||||
nsCOMArray<nsIFile> baseFiles;
|
||||
|
||||
AppendDistroSearchDirs(dirSvc, baseFiles);
|
||||
AppendFileKey(NS_APP_SEARCH_DIR, dirSvc, baseFiles);
|
||||
AppendFileKey(NS_APP_USER_SEARCH_DIR, dirSvc, baseFiles);
|
||||
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Firefox Distribution Customizations.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dan Mills <thunder@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
EXPORTED_SYMBOLS = [ "DistributionCustomizer" ];
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
function DistributionCustomizer() {
|
||||
this._distroDir = this._dirSvc.get("XCurProcD", Ci.nsIFile);
|
||||
this._distroDir.append("distribution");
|
||||
|
||||
let iniFile = this._distroDir.clone();
|
||||
iniFile.append("distribution.ini");
|
||||
this._iniExists = iniFile.exists();
|
||||
|
||||
if (!this._iniExists)
|
||||
return;
|
||||
|
||||
this._ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory).createINIParser(iniFile);
|
||||
|
||||
this._prefs = this._prefSvc.getBranch(null);
|
||||
this._locale = this._prefs.getCharPref("general.useragent.locale");
|
||||
|
||||
}
|
||||
DistributionCustomizer.prototype = {
|
||||
__bmSvc: null,
|
||||
get _bmSvc() {
|
||||
if (!this.__bmSvc)
|
||||
this.__bmSvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
return this.__bmSvc;
|
||||
},
|
||||
|
||||
__annoSvc: null,
|
||||
get _annoSvc() {
|
||||
if (!this.__annoSvc)
|
||||
this.__annoSvc = Cc["@mozilla.org/browser/annotation-service;1"].
|
||||
getService(Ci.nsIAnnotationService);
|
||||
return this.__annoSvc;
|
||||
},
|
||||
|
||||
__dirSvc: null,
|
||||
get _dirSvc() {
|
||||
if (!this.__dirSvc)
|
||||
this.__dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
return this.__dirSvc;
|
||||
},
|
||||
|
||||
__prefSvc: null,
|
||||
get _prefSvc() {
|
||||
if (!this.__prefSvc)
|
||||
this.__prefSvc = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService);
|
||||
return this.__prefSvc;
|
||||
},
|
||||
|
||||
__iosvc: null,
|
||||
get _iosvc() {
|
||||
if (!this.__iosvc)
|
||||
this.__iosvc = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return this.__iosvc;
|
||||
},
|
||||
|
||||
_locale: "en-US",
|
||||
_distroDir: null,
|
||||
_iniExists: false,
|
||||
_ini: null,
|
||||
|
||||
|
||||
_makeURI: function DIST__makeURI(spec) {
|
||||
return this._iosvc.newURI(spec, null, null);
|
||||
},
|
||||
_parseBookmarksSection: function DIST_parseBookmarksSection(parentId, section) {
|
||||
let keys = [];
|
||||
for (let i in enumerate(this._ini.getKeys(section)))
|
||||
keys.push(i);
|
||||
keys.sort();
|
||||
let items = {};
|
||||
let defaultItemId = -1;
|
||||
let maxItemId = -1;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let m = /^item\.(\d+)\.(\w+)\.?(\w*)/.exec(keys[i]);
|
||||
if (m) {
|
||||
let [foo, iid, iprop, ilocale] = m;
|
||||
|
||||
if (ilocale)
|
||||
continue;
|
||||
|
||||
if (!items[iid])
|
||||
items[iid] = {};
|
||||
if (keys.indexOf(keys[i] + "." + this._locale) >= 0) {
|
||||
items[iid][iprop] = this._ini.getString(section, keys[i] + "." +
|
||||
this._locale);
|
||||
} else {
|
||||
items[iid][iprop] = this._ini.getString(section, keys[i]);
|
||||
}
|
||||
|
||||
if (iprop == "type" && items[iid]["type"] == "default")
|
||||
defaultItemId = iid;
|
||||
|
||||
if (maxItemId < iid)
|
||||
maxItemId = iid;
|
||||
} else {
|
||||
dump("Key did not match: " + keys[i] + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
let prependIndex = 0;
|
||||
for (let iid = 0; iid <= maxItemId; iid++) {
|
||||
if (!items[iid])
|
||||
continue;
|
||||
|
||||
let index = -1;
|
||||
let newId;
|
||||
|
||||
switch (items[iid]["type"]) {
|
||||
case "default":
|
||||
break;
|
||||
|
||||
case "folder":
|
||||
if (iid < defaultItemId)
|
||||
index = prependIndex++;
|
||||
|
||||
newId = this._bmSvc.createFolder(parentId, items[iid]["title"], index);
|
||||
|
||||
this._parseBookmarksSection(newId, "BookmarksFolder-" +
|
||||
items[iid]["folderId"]);
|
||||
|
||||
if (items[iid]["description"])
|
||||
this._annoSvc.setItemAnnotation(newId, "bookmarkProperties/description",
|
||||
items[iid]["description"], 0,
|
||||
this._annoSvc.EXPIRE_NEVER);
|
||||
|
||||
break;
|
||||
|
||||
case "separator":
|
||||
if (iid < defaultItemId)
|
||||
index = prependIndex++;
|
||||
this._bmSvc.insertSeparator(parentId, index);
|
||||
break;
|
||||
|
||||
case "bookmark":
|
||||
default:
|
||||
if (iid < defaultItemId)
|
||||
index = prependIndex++;
|
||||
|
||||
newId = this._bmSvc.insertBookmark(parentId,
|
||||
this._makeURI(items[iid]["link"]),
|
||||
index, items[iid]["title"]);
|
||||
|
||||
if (items[iid]["description"])
|
||||
this._annoSvc.setItemAnnotation(newId, "bookmarkProperties/description",
|
||||
items[iid]["description"], 0,
|
||||
this._annoSvc.EXPIRE_NEVER);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
applyCustomizations: function DIST_applyCustomizations() {
|
||||
if (!this._iniExists)
|
||||
return;
|
||||
|
||||
// nsPrefService loads very early. Reload prefs so we can set
|
||||
// distribution defaults during the prefservice:after-app-defaults
|
||||
// notification (see applyPrefDefaults below)
|
||||
this._prefSvc.QueryInterface(Ci.nsIObserver);
|
||||
this._prefSvc.observe(null, "reload-default-prefs", null);
|
||||
|
||||
let sections = enumToObject(this._ini.getSections());
|
||||
|
||||
// The global section, and several of its fields, is required
|
||||
// (we also check here to be consistent with applyPrefDefaults below)
|
||||
if (!sections["Global"])
|
||||
return;
|
||||
let globalPrefs = enumToObject(this._ini.getKeys("Global"));
|
||||
if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"]))
|
||||
return;
|
||||
|
||||
let bmProcessed = false;
|
||||
let bmProcessedPref = "distribution." +
|
||||
this._ini.getString("Global", "id") + ".bookmarksProcessed";
|
||||
try {
|
||||
bmProcessed = this._prefs.getBoolPref(bmProcessedPref);
|
||||
} catch (e) {}
|
||||
|
||||
if (!bmProcessed) {
|
||||
if (sections["BookmarksMenu"])
|
||||
this._parseBookmarksSection(this._bmSvc.bookmarksRoot,
|
||||
"BookmarksMenu");
|
||||
if (sections["BookmarksToolbar"])
|
||||
this._parseBookmarksSection(this._bmSvc.toolbarFolder,
|
||||
"BookmarksToolbar");
|
||||
this._prefs.setBoolPref(bmProcessedPref, true);
|
||||
}
|
||||
},
|
||||
applyPrefDefaults: function DIST_applyPrefDefaults() {
|
||||
if (!this._iniExists)
|
||||
return;
|
||||
|
||||
let sections = enumToObject(this._ini.getSections());
|
||||
|
||||
// The global section, and several of its fields, is required
|
||||
if (!sections["Global"])
|
||||
return;
|
||||
let globalPrefs = enumToObject(this._ini.getKeys("Global"));
|
||||
if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"]))
|
||||
return;
|
||||
|
||||
let defaults = this._prefSvc.getDefaultBranch(null);
|
||||
|
||||
// Global really contains info we set as prefs. They're only
|
||||
// separate because they are "special" (read: required)
|
||||
|
||||
defaults.setCharPref("distribution.id", this._ini.getString("Global", "id"));
|
||||
defaults.setCharPref("distribution.version",
|
||||
this._ini.getString("Global", "version"));
|
||||
|
||||
let partnerAbout = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
if (globalPrefs["about." + this._locale]) {
|
||||
partnerAbout.data = this._ini.getString("Global", "about." + this._locale);
|
||||
} else {
|
||||
partnerAbout.data = this._ini.getString("Global", "about");
|
||||
}
|
||||
defaults.setComplexValue("distribution.about",
|
||||
Ci.nsISupportsString, partnerAbout);
|
||||
|
||||
if (sections["Preferences"]) {
|
||||
for (let key in enumerate(this._ini.getKeys("Preferences"))) {
|
||||
try {
|
||||
let value = eval(this._ini.getString("Preferences", key));
|
||||
switch (typeof value) {
|
||||
case "bool":
|
||||
defaults.setBoolPref(key, value);
|
||||
break;
|
||||
case "int":
|
||||
defaults.setIntPref(key, value);
|
||||
break;
|
||||
case "string":
|
||||
defaults.setCharPref(key, value);
|
||||
break;
|
||||
case "undefined":
|
||||
defaults.setCharPref(key, value);
|
||||
break;
|
||||
}
|
||||
} catch (e) { /* ignore bad prefs and move on */ }
|
||||
}
|
||||
}
|
||||
|
||||
// We eval() the localizable prefs as well (even though they'll
|
||||
// always get set as a string) to keep the INI format consistent:
|
||||
// string prefs always need to be in quotes
|
||||
|
||||
let localizedStr = Cc["@mozilla.org/pref-localizedstring;1"].
|
||||
createInstance(Ci.nsIPrefLocalizedString);
|
||||
|
||||
if (sections["LocalizablePreferences"]) {
|
||||
for (let key in enumerate(this._ini.getKeys("LocalizablePreferences"))) {
|
||||
try {
|
||||
let value = eval(this._ini.getString("LocalizablePreferences", key));
|
||||
value = value.replace("%LOCALE%", this._locale, "g");
|
||||
localizedStr.data = "data:text/plain," + key + "=" + value;
|
||||
defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr);
|
||||
} catch (e) { /* ignore bad prefs and move on */ }
|
||||
}
|
||||
}
|
||||
|
||||
if (sections["LocalizablePreferences-" + this._locale]) {
|
||||
for (let key in enumerate(this._ini.getKeys("LocalizablePreferences-" + this._locale))) {
|
||||
try {
|
||||
let value = eval(this._ini.getString("LocalizablePreferences-" + this._locale, key));
|
||||
localizedStr.data = "data:text/plain," + key + "=" + value;
|
||||
defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr);
|
||||
} catch (e) { /* ignore bad prefs and move on */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function enumerate(UTF8Enumerator) {
|
||||
while (UTF8Enumerator.hasMore())
|
||||
yield UTF8Enumerator.getNext();
|
||||
}
|
||||
|
||||
function enumToObject(UTF8Enumerator) {
|
||||
let ret = {};
|
||||
for (let i in enumerate(UTF8Enumerator))
|
||||
ret[i] = 1;
|
||||
return ret;
|
||||
}
|
|
@ -36,11 +36,12 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIMIMEInfo.idl"
|
||||
|
||||
interface nsIRequest;
|
||||
|
||||
[scriptable, uuid(2bd97d63-e928-4d52-9fd4-34061349a9a6)]
|
||||
interface nsIWebContentHandlerInfo : nsISupports
|
||||
[scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)]
|
||||
interface nsIWebContentHandlerInfo : nsIHandlerApp
|
||||
{
|
||||
/**
|
||||
* The content type handled by the handler
|
||||
|
@ -53,11 +54,6 @@ interface nsIWebContentHandlerInfo : nsISupports
|
|||
*/
|
||||
readonly attribute AString uri;
|
||||
|
||||
/**
|
||||
* A human readable title of the handler.
|
||||
*/
|
||||
readonly attribute AString name;
|
||||
|
||||
/**
|
||||
* Gets the service URL Spec, with the loading document URI encoded in it.
|
||||
* @param uri
|
||||
|
@ -66,15 +62,6 @@ interface nsIWebContentHandlerInfo : nsISupports
|
|||
* it.
|
||||
*/
|
||||
AString getHandlerURI(in AString uri);
|
||||
|
||||
/**
|
||||
* Determines if this handler object is equivalent to another.
|
||||
* @param other
|
||||
* The other handler info object
|
||||
* @returns true if the two objects are equivalent (same content type,
|
||||
* same uri).
|
||||
*/
|
||||
boolean equals(in nsIWebContentHandlerInfo other);
|
||||
};
|
||||
|
||||
[scriptable, uuid(632b16a8-5c6b-4dc5-a8db-01771af7a79d)]
|
||||
|
|
|
@ -357,27 +357,25 @@ var FeedResultService = {
|
|||
switch (handler) {
|
||||
case "client":
|
||||
var clientApp = prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
|
||||
#ifdef XP_MACOSX
|
||||
// On OS X, the built in feed dispatcher (Safari) sends feeds to other
|
||||
// applications (When Default Reader is adjusted) in the following format:
|
||||
|
||||
// For the benefit of applications that might know how to deal with more
|
||||
// URLs than just feeds, send feed: URLs in the following format:
|
||||
//
|
||||
// http urls: replace scheme with feed, e.g.
|
||||
// http://foo.com/index.rdf -> feed://foo.com/index.rdf
|
||||
// other urils: prepend feed: scheme, e.g.
|
||||
// other urls: prepend feed: scheme, e.g.
|
||||
// https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
|
||||
//
|
||||
// We duplicate this here for compatibility.
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var macURI = ios.newURI(spec, null, null);
|
||||
if (macURI.schemeIs("http")) {
|
||||
macURI.scheme = "feed";
|
||||
spec = macURI.spec;
|
||||
var feedURI = ios.newURI(spec, null, null);
|
||||
if (feedURI.schemeIs("http")) {
|
||||
feedURI.scheme = "feed";
|
||||
spec = feedURI.spec;
|
||||
}
|
||||
else
|
||||
spec = "feed:" + spec;
|
||||
#endif
|
||||
|
||||
var ss =
|
||||
Cc["@mozilla.org/browser/shell-service;1"].
|
||||
getService(Ci.nsIShellService);
|
||||
|
|
|
@ -110,6 +110,28 @@ function ServiceInfo(contentType, uri, name) {
|
|||
this._name = name;
|
||||
}
|
||||
ServiceInfo.prototype = {
|
||||
/**
|
||||
* See nsIHandlerApp
|
||||
*/
|
||||
get name() {
|
||||
return this._name;
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIHandlerApp
|
||||
*/
|
||||
equals: function SI_equals(aHandlerApp) {
|
||||
if (!aHandlerApp)
|
||||
throw Cr.NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo &&
|
||||
aHandlerApp.contentType == this.contentType &&
|
||||
aHandlerApp.uri == this.uri)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIWebContentHandlerInfo
|
||||
*/
|
||||
|
@ -124,13 +146,6 @@ ServiceInfo.prototype = {
|
|||
return this._uri;
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIWebContentHandlerInfo
|
||||
*/
|
||||
get name() {
|
||||
return this._name;
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIWebContentHandlerInfo
|
||||
*/
|
||||
|
@ -138,14 +153,6 @@ ServiceInfo.prototype = {
|
|||
return this._uri.replace(/%s/gi, encodeURIComponent(uri));
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIWebContentHandlerInfo
|
||||
*/
|
||||
equals: function SI_equals(other) {
|
||||
return this.contentType == other.contentType &&
|
||||
this.uri == other.uri;
|
||||
},
|
||||
|
||||
QueryInterface: function SI_QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
|
|
|
@ -1,43 +1,59 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Firefox Browser Glue Service.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Giorgio Maone
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Giorgio Maone <g.maone@informaction.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Browser Search Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Giorgio Maone
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Giorgio Maone <g.maone@informaction.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/distribution.js");
|
||||
|
||||
// Factory object
|
||||
const BrowserGlueServiceFactory = {
|
||||
_instance: null,
|
||||
createInstance: function (outer, iid)
|
||||
{
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return this._instance == null ?
|
||||
this._instance = new BrowserGlue() : this._instance;
|
||||
}
|
||||
};
|
||||
|
||||
// Constructor
|
||||
|
||||
|
@ -49,12 +65,6 @@ function BrowserGlue() {
|
|||
BrowserGlue.prototype = {
|
||||
_saveSession: false,
|
||||
|
||||
QueryInterface: function(iid)
|
||||
{
|
||||
xpcomCheckInterfaces(iid, kServiceIIds, Cr.NS_ERROR_NO_INTERFACE);
|
||||
return this;
|
||||
}
|
||||
,
|
||||
// nsIObserver implementation
|
||||
observe: function(subject, topic, data)
|
||||
{
|
||||
|
@ -68,6 +78,9 @@ BrowserGlue.prototype = {
|
|||
case "profile-change-teardown":
|
||||
this._onProfileShutdown();
|
||||
break;
|
||||
case "prefservice:after-app-defaults":
|
||||
this._onAppDefaults();
|
||||
break;
|
||||
case "final-ui-startup":
|
||||
this._onProfileStartup();
|
||||
break;
|
||||
|
@ -100,6 +113,7 @@ BrowserGlue.prototype = {
|
|||
osvr.addObserver(this, "profile-before-change", false);
|
||||
osvr.addObserver(this, "profile-change-teardown", false);
|
||||
osvr.addObserver(this, "xpcom-shutdown", false);
|
||||
osvr.addObserver(this, "prefservice:after-app-defaults", false);
|
||||
osvr.addObserver(this, "final-ui-startup", false);
|
||||
osvr.addObserver(this, "browser:purge-session-history", false);
|
||||
osvr.addObserver(this, "quit-application-requested", false);
|
||||
|
@ -115,12 +129,21 @@ BrowserGlue.prototype = {
|
|||
osvr.removeObserver(this, "profile-before-change");
|
||||
osvr.removeObserver(this, "profile-change-teardown");
|
||||
osvr.removeObserver(this, "xpcom-shutdown");
|
||||
osvr.removeObserver(this, "prefservice:after-app-defaults");
|
||||
osvr.removeObserver(this, "final-ui-startup");
|
||||
osvr.removeObserver(this, "browser:purge-session-history");
|
||||
osvr.removeObserver(this, "quit-application-requested");
|
||||
osvr.removeObserver(this, "quit-application-granted");
|
||||
},
|
||||
|
||||
_onAppDefaults: function()
|
||||
{
|
||||
// apply distribution customizations (prefs)
|
||||
// other customizations are applied in _onProfileStartup()
|
||||
var distro = new DistributionCustomizer();
|
||||
distro.applyPrefDefaults();
|
||||
},
|
||||
|
||||
// profile startup handler (contains profile initialization routines)
|
||||
_onProfileStartup: function()
|
||||
{
|
||||
|
@ -155,6 +178,11 @@ BrowserGlue.prototype = {
|
|||
// initialize Places
|
||||
this._initPlaces();
|
||||
|
||||
// apply distribution customizations
|
||||
// prefs are applied in _onAppDefaults()
|
||||
var distro = new DistributionCustomizer();
|
||||
distro.applyCustomizations();
|
||||
|
||||
// indicate that the profile was initialized
|
||||
this._profileStarted = true;
|
||||
},
|
||||
|
@ -366,111 +394,31 @@ BrowserGlue.prototype = {
|
|||
sanitize: function(aParentWindow)
|
||||
{
|
||||
this.Sanitizer.sanitize(aParentWindow);
|
||||
}
|
||||
},
|
||||
|
||||
// for XPCOM
|
||||
classDescription: "Firefox Browser Glue Service",
|
||||
classID: Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"),
|
||||
contractID: "@mozilla.org/browser/browserglue;1",
|
||||
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupports,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIBrowserGlue]),
|
||||
|
||||
// redefine the default factory for XPCOMUtils
|
||||
_xpcom_factory: BrowserGlueServiceFactory,
|
||||
|
||||
// get this contractID registered for certain categories via XPCOMUtils
|
||||
_xpcom_categories: [
|
||||
// make BrowserGlue a startup observer
|
||||
{ category: "app-startup", service: true }
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// XPCOM Scaffolding code
|
||||
|
||||
// component defined in this file
|
||||
|
||||
const kServiceName = "Firefox Browser Glue Service";
|
||||
const kServiceId = "{eab9012e-5f74-4cbc-b2b5-a590235513cc}";
|
||||
const kServiceCtrId = "@mozilla.org/browser/browserglue;1";
|
||||
const kServiceConstructor = BrowserGlue;
|
||||
|
||||
const kServiceCId = Components.ID(kServiceId);
|
||||
|
||||
// interfaces implemented by this component
|
||||
const kServiceIIds = [
|
||||
Ci.nsIObserver,
|
||||
Ci.nsISupports,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIBrowserGlue
|
||||
];
|
||||
|
||||
// categories which this component is registered in
|
||||
const kServiceCats = ["app-startup"];
|
||||
|
||||
// Factory object
|
||||
const kServiceFactory = {
|
||||
_instance: null,
|
||||
createInstance: function (outer, iid)
|
||||
{
|
||||
if (outer != null) throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
xpcomCheckInterfaces(iid, kServiceIIds,
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
return this._instance == null ?
|
||||
this._instance = new kServiceConstructor() : this._instance;
|
||||
}
|
||||
};
|
||||
|
||||
function xpcomCheckInterfaces(iid, iids, ex) {
|
||||
for (var j = iids.length; j-- >0;) {
|
||||
if (iid.equals(iids[j])) return true;
|
||||
}
|
||||
throw ex;
|
||||
//module initialization
|
||||
function NSGetModule(aCompMgr, aFileSpec) {
|
||||
return XPCOMUtils.generateModule([BrowserGlue]);
|
||||
}
|
||||
|
||||
// Module
|
||||
|
||||
|
||||
var Module = {
|
||||
registered: false,
|
||||
|
||||
registerSelf: function(compMgr, fileSpec, location, type)
|
||||
{
|
||||
if (!this.registered) {
|
||||
compMgr.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.registerFactoryLocation(kServiceCId,
|
||||
kServiceName,
|
||||
kServiceCtrId,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
const catman = Cc['@mozilla.org/categorymanager;1'].
|
||||
getService(Ci.nsICategoryManager);
|
||||
var len = kServiceCats.length;
|
||||
for (var j = 0; j < len; j++) {
|
||||
catman.addCategoryEntry(kServiceCats[j],
|
||||
kServiceCtrId, kServiceCtrId, true, true);
|
||||
}
|
||||
this.registered = true;
|
||||
}
|
||||
},
|
||||
|
||||
unregisterSelf: function(compMgr, fileSpec, location)
|
||||
{
|
||||
compMgr.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.unregisterFactoryLocation(kServiceCId, fileSpec);
|
||||
const catman = Cc['@mozilla.org/categorymanager;1'].
|
||||
getService(Ci.nsICategoryManager);
|
||||
var len = kServiceCats.length;
|
||||
for (var j = 0; j < len; j++) {
|
||||
catman.deleteCategoryEntry(kServiceCats[j], kServiceCtrId, true);
|
||||
}
|
||||
},
|
||||
|
||||
getClassObject: function(compMgr, cid, iid)
|
||||
{
|
||||
if(cid.equals(kServiceCId))
|
||||
return kServiceFactory;
|
||||
|
||||
throw Cr[
|
||||
iid.equals(Ci.nsIFactory)
|
||||
? "NS_ERROR_NO_INTERFACE"
|
||||
: "NS_ERROR_NOT_IMPLEMENTED"
|
||||
];
|
||||
|
||||
},
|
||||
|
||||
canUnload: function(compMgr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// entrypoint
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return Module;
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ var PlacesOrganizer = {
|
|||
if (window.fromFile)
|
||||
this.importFromFile();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Open a file-picker and import the selected file into the bookmarks store
|
||||
*/
|
||||
|
@ -307,6 +307,141 @@ var PlacesOrganizer = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Populates the restore menu with the dates of the backups available.
|
||||
*/
|
||||
populateRestoreMenu: function PO_populateRestoreMenu() {
|
||||
var restorePopup = document.getElementById("fileRestorePopup");
|
||||
|
||||
// remove existing menu items
|
||||
// last item is the restoreFromFile item
|
||||
while (restorePopup.childNodes.length > 1)
|
||||
restorePopup.removeChild(restorePopup.firstChild);
|
||||
|
||||
// get bookmarks backup dir
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var bookmarksBackupDir = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
bookmarksBackupDir.append("bookmarkbackups");
|
||||
if (!bookmarksBackupDir.exists())
|
||||
return; // no backup files
|
||||
|
||||
// get list of files
|
||||
var fileList = [];
|
||||
var files = bookmarksBackupDir.directoryEntries;
|
||||
while (files.hasMoreElements()) {
|
||||
var f = files.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (!f.isHidden() && f.leafName.match(/\.html?$/))
|
||||
fileList.push(f);
|
||||
}
|
||||
|
||||
fileList.sort(function PO_fileList_compare(a, b) {
|
||||
return b.lastModifiedTime - a.lastModifiedTime;
|
||||
});
|
||||
|
||||
if (fileList.length == 0)
|
||||
return;
|
||||
|
||||
// populate menu
|
||||
for (var i = 0; i < fileList.length; i++) {
|
||||
var m = restorePopup.insertBefore
|
||||
(document.createElement("menuitem"),
|
||||
document.getElementById("restoreFromFile"));
|
||||
var dateStr = fileList[i].leafName.replace("bookmarks-", "").
|
||||
replace(".html", "");
|
||||
if (!dateStr.length)
|
||||
dateStr = fileList[i].leafName;
|
||||
m.setAttribute("label", dateStr);
|
||||
m.setAttribute("value", fileList[i].leafName);
|
||||
m.setAttribute("oncommand",
|
||||
"PlacesOrganizer.onRestoreMenuItemClick(this);");
|
||||
}
|
||||
restorePopup.insertBefore(document.createElement("menuseparator"),
|
||||
document.getElementById("restoreFromFile"));
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when a menuitem is selected from the restore menu.
|
||||
*/
|
||||
onRestoreMenuItemClick: function PO_onRestoreMenuItemClick(aMenuItem) {
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var bookmarksFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
bookmarksFile.append("bookmarkbackups");
|
||||
bookmarksFile.append(aMenuItem.getAttribute("value"));
|
||||
if (!bookmarksFile.exists())
|
||||
return;
|
||||
|
||||
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService);
|
||||
if (!prompts.confirm(null,
|
||||
PlacesUtils.getString("bookmarksRestoreAlertTitle"),
|
||||
PlacesUtils.getString("bookmarksRestoreAlert")))
|
||||
return;
|
||||
|
||||
var ieSvc = Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
ieSvc.importHTMLFromFile(bookmarksFile, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Backup bookmarks to desktop, auto-generate a filename with a date
|
||||
*/
|
||||
backupBookmarks: function PO_backupBookmarks() {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, PlacesUtils.getString("bookmarksBackupTitle"),
|
||||
Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
fp.displayDirectory = backupsDir;
|
||||
|
||||
var dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
||||
getService(Ci.nsIScriptableDateFormat);
|
||||
|
||||
var d = new Date();
|
||||
var date = dateService.FormatDate("", dateService.dateFormatShort,
|
||||
d.getFullYear(), d.getMonth() + 1, d.getDate());
|
||||
fp.defaultString = PlacesUtils.getFormattedString("bookmarksBackupFilename",
|
||||
[date]);
|
||||
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
var ieSvc = Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
ieSvc.exportHTMLToFile(fp.file);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when 'Choose File...' is selected from the Revert menupopup
|
||||
* Prompts for a file and reverts bookmarks to those in the file
|
||||
*/
|
||||
restoreFromFile: function PO_restoreFromFile() {
|
||||
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService);
|
||||
if (!prompts.confirm(null, PlacesUtils.getString("bookmarksRestoreAlertTitle"),
|
||||
PlacesUtils.getString("bookmarksRestoreAlert")))
|
||||
return;
|
||||
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, PlacesUtils.getString("bookmarksRestoreTitle"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
fp.displayDirectory = backupsDir;
|
||||
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
var ieSvc = Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
ieSvc.importHTMLFromFile(fp.file, true);
|
||||
}
|
||||
},
|
||||
|
||||
updateStatusBarForView: function PO_updateStatusBarForView(aView) {
|
||||
var statusText = "";
|
||||
var selectedNode = aView.selectedNode;
|
||||
|
|
|
@ -86,6 +86,10 @@
|
|||
oncommand="PlacesOrganizer.exportBookmarks();"/>
|
||||
<command id="OrganizerCommand_import"
|
||||
oncommand="PlacesOrganizer.importBookmarks();"/>
|
||||
<command id="OrganizerCommand_backup"
|
||||
oncommand="PlacesOrganizer.backupBookmarks();"/>
|
||||
<command id="OrganizerCommand_restoreFromFile"
|
||||
oncommand="PlacesOrganizer.restoreFromFile();"/>
|
||||
<command id="OrganizerCommand_search:save"
|
||||
oncommand="PlacesOrganizer.saveSearch();"/>
|
||||
<command id="OrganizerCommand_search:moreCriteria"
|
||||
|
@ -188,6 +192,20 @@
|
|||
label="&cmd.export.label;"
|
||||
accesskey="&cmd.export.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="backupBookmarks"
|
||||
command="OrganizerCommand_backup"
|
||||
label="&cmd.backup.label;"
|
||||
accesskey="&cmd.backup.accesskey;"/>
|
||||
<menu id="fileRestoreMenu" label="&cmd.restore.label;"
|
||||
accesskey="&cmd.export.accesskey;">
|
||||
<menupopup id="fileRestorePopup" onpopupshowing="PlacesOrganizer.populateRestoreMenu();">
|
||||
<menuitem id="restoreFromFile"
|
||||
command="OrganizerCommand_restoreFromFile"
|
||||
label="&cmd.restoreFromFile.label;"
|
||||
accesskey="&cmd.restoreFromFile.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem id="fileClose"
|
||||
key="placesKey_close"
|
||||
label="&file.close.label;"
|
||||
|
|
|
@ -158,16 +158,19 @@
|
|||
command="cmd_cut"
|
||||
label="&cutCmd.label;"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
closemenu="single"
|
||||
selection="separator|link|folder|mixed|query"
|
||||
forcehideselection="livemarkChild"/>
|
||||
<menuitem id="placesContext_copy"
|
||||
command="cmd_copy"
|
||||
label="©Cmd.label;"
|
||||
closemenu="single"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
selection="separator|link|folder|query"/>
|
||||
<menuitem id="placesContext_paste"
|
||||
command="cmd_paste"
|
||||
label="&pasteCmd.label;"
|
||||
closemenu="single"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
selection="mutable|query"/>
|
||||
<menuseparator id="placesContext_editSeparator"/>
|
||||
|
|
|
@ -794,14 +794,16 @@
|
|||
var ind = ib.firstChild;
|
||||
var direction = document.defaultView.getComputedStyle(this._self.parentNode, "").direction;
|
||||
if (direction == "ltr") {
|
||||
if (dropPoint.beforeIndex == -1)
|
||||
if (!this._self.childNodes.length)
|
||||
ind.style.marginLeft = 0 - this._self.boxObject.x - 7 + 'px'
|
||||
else if (dropPoint.beforeIndex == -1)
|
||||
ind.style.marginLeft = this._self.lastChild.boxObject.x +
|
||||
this._self.lastChild.boxObject.width - this._self.boxObject.x - 7 + 'px';
|
||||
else
|
||||
ind.style.marginLeft = this._self.childNodes[dropPoint.beforeIndex].boxObject.x -
|
||||
this._self.boxObject.x - 7 + 'px';
|
||||
} else {
|
||||
if (dropPoint.beforeIndex == -1)
|
||||
if (dropPoint.beforeIndex == -1 || !this._self.childNodes.length)
|
||||
ind.style.marginRight = '0px';
|
||||
else
|
||||
ind.style.marginRight = (this._self.childNodes[this._self.childNodes.length - 1].boxObject.x +
|
||||
|
|
|
@ -51,6 +51,7 @@ Components.utils.import("resource://gre/modules/JSON.jsm");
|
|||
const LOAD_IN_SIDEBAR_ANNO = "bookmarkProperties/loadInSidebar";
|
||||
const DESCRIPTION_ANNO = "bookmarkProperties/description";
|
||||
const POST_DATA_ANNO = "URIProperties/POSTData";
|
||||
const LMANNO_FEEDURI = "livemark/feedURI";
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// On Mac OSX, the transferable system converts "\r\n" to "\n\n", where we
|
||||
|
@ -398,7 +399,7 @@ var PlacesUtils = {
|
|||
*/
|
||||
nodeIsLivemarkContainer: function PU_nodeIsLivemarkContainer(aNode) {
|
||||
return this.nodeIsFolder(aNode) &&
|
||||
this.annotations.itemHasAnnotation(aNode.itemId, "livemark/feedURI");
|
||||
this.annotations.itemHasAnnotation(aNode.itemId, LMANNO_FEEDURI);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1507,12 +1508,24 @@ var PlacesUtils = {
|
|||
return bk;
|
||||
var grandparent = this.bookmarks.getFolderIdForItem(parent);
|
||||
if (grandparent != this.tagRootId &&
|
||||
!this.annotations.itemHasAnnotation(parent, "livemark/feedURI"))
|
||||
!this.annotations.itemHasAnnotation(parent, LMANNO_FEEDURI))
|
||||
return bk;
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
|
||||
getMostRecentFolderForFeedURI:
|
||||
function PU_getMostRecentFolderForFeedURI(aURI) {
|
||||
var feedSpec = aURI.spec
|
||||
var annosvc = this.annotations;
|
||||
var livemarks = annosvc.getItemsWithAnnotation(LMANNO_FEEDURI, {});
|
||||
for (var i = 0; i < livemarks.length; i++) {
|
||||
if (annosvc.getItemAnnotation(livemarks[i], LMANNO_FEEDURI) == feedSpec)
|
||||
return livemarks[i];
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
|
||||
getURLsForContainerNode: function PU_getURLsForContainerNode(aNode) {
|
||||
let urls = [];
|
||||
if (this.nodeIsFolder(aNode) && asQuery(aNode).queryOptions.excludeItems) {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Firefox Preferences System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
# Jeff Walden <jwalden+code@mit.edu>.
|
||||
# Asaf Romano <mozilla.mano@sent.com>
|
||||
# Myk Melez <myk@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
|
||||
%brandDTD;
|
||||
%applicationsDTD;
|
||||
]>
|
||||
|
||||
<overlay id="ApplicationsPaneOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<prefpane id="paneApplications" onpaneload="gApplicationsPane.init();"
|
||||
helpTopic="prefs-applications" helpURI="chrome://browser/locale/help/help.rdf">
|
||||
|
||||
<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"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/preferences/applications.js"/>
|
||||
|
||||
<keyset>
|
||||
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
|
||||
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
|
||||
</keyset>
|
||||
|
||||
<label>&prefpane.label;</label>
|
||||
|
||||
<vbox flex="1" class="contentPane">
|
||||
<hbox align="center">
|
||||
<label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
|
||||
<textbox id="filter" flex="1" oninput="gApplicationsPane.onFilterInput();"
|
||||
onkeypress="gApplicationsPane.onFilterKeyPress(event);"/>
|
||||
<button id="clearFilter" icon="clear" label="&clear.label;" accesskey="&clear.accesskey;"
|
||||
oncommand="gApplicationsPane.clearFilter();" disabled="true"/>
|
||||
</hbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<label id="filterActiveLabel" hidden="true">
|
||||
&filterActive.label;
|
||||
</label>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<richlistbox id="handlersView" orient="vertical" style="height: 300px"
|
||||
onselect="gApplicationsPane.onSelectionChanged();"
|
||||
persist="lastSelectedType">
|
||||
<listheader equalsize="always" style="border: 0; padding: 0;">
|
||||
<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="&actionColumn.label;" value="action"
|
||||
accesskey="&actionColumn.accesskey;" persist="sortDirection"
|
||||
flex="1" onclick="gApplicationsPane.sort(event);"/>
|
||||
</listheader>
|
||||
</richlistbox>
|
||||
</vbox>
|
||||
|
||||
</prefpane>
|
||||
</overlay>
|
|
@ -1,255 +0,0 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Download Actions Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
var gChangeActionDialog = {
|
||||
_item : null,
|
||||
_bundle : null,
|
||||
_lastSelectedMode : null,
|
||||
_lastSelectedSave : null,
|
||||
|
||||
init: function ()
|
||||
{
|
||||
this._item = window.arguments[0];
|
||||
this._bundle = document.getElementById("bundlePreferences");
|
||||
dump("*** ir = " + this._item.toSource() + "\n");
|
||||
|
||||
var typeField = document.getElementById("typeField");
|
||||
typeField.value = this._item.typeName;
|
||||
|
||||
var extensionField = document.getElementById("extensionField");
|
||||
var ext = "." + this._item.extension.toLowerCase();
|
||||
var contentType = this._item.type;
|
||||
extensionField.value = this._bundle.getFormattedString("extensionStringFormat", [ext, contentType]);
|
||||
|
||||
var typeIcon = document.getElementById("typeIcon");
|
||||
typeIcon.src = this._item.bigIcon;
|
||||
|
||||
// Custom App Handler Path - this must be set before we set the selected
|
||||
// radio button because the selection event handler for the radio group
|
||||
// requires the extapp handler field to be non-empty for the extapp radio
|
||||
// button to be selected.
|
||||
var customApp = document.getElementById("customApp");
|
||||
if (this._item.customHandler)
|
||||
customApp.file = this._item.customHandler;
|
||||
else
|
||||
customApp.file = null;
|
||||
|
||||
var defaultApp = document.getElementById("defaultApp");
|
||||
var defaultAppIcon = null;
|
||||
var fallbackIconURL = "moz-icon://goat?contentType=" + this._item.type + "&size=16";
|
||||
if (this._item.mimeInfo instanceof Components.interfaces.nsIPropertyBag) {
|
||||
try {
|
||||
defaultAppIcon = this._item.mimeInfo.getProperty("defaultApplicationIconURL");
|
||||
}
|
||||
catch (e) { }
|
||||
if (defaultAppIcon)
|
||||
defaultAppIcon += "?size=16";
|
||||
}
|
||||
defaultApp.image = defaultAppIcon || fallbackIconURL;
|
||||
defaultApp.label = this._item.mimeInfo.defaultDescription;
|
||||
|
||||
var pluginName = document.getElementById("pluginName");
|
||||
var foundPlugin = false;
|
||||
for (var i = 0; i < navigator.plugins.length; ++i) {
|
||||
var plugin = navigator.plugins[i];
|
||||
for (var j = 0; j < plugin.length; ++j) {
|
||||
if (contentType == plugin[j].type) {
|
||||
pluginName.label = plugin.name;
|
||||
pluginName.image = "moz-icon://goat.goat?contentType=" + contentType + "&size=16";
|
||||
foundPlugin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundPlugin) {
|
||||
pluginName.label = this._bundle.getString("pluginHelperNoneAvailable");
|
||||
document.getElementById("plugin").disabled = true;
|
||||
}
|
||||
|
||||
// Selected Action Radiogroup
|
||||
var handlerGroup = document.getElementById("handlerGroup");
|
||||
if (this._item.handleMode == FILEACTION_OPEN_PLUGIN && this._item.pluginEnabled)
|
||||
handlerGroup.selectedItem = document.getElementById("plugin");
|
||||
else {
|
||||
if (this._item.handleMode == FILEACTION_OPEN_DEFAULT)
|
||||
handlerGroup.selectedItem = document.getElementById("openDefault");
|
||||
else if (this._item.handleMode == FILEACTION_SAVE_TO_DISK)
|
||||
handlerGroup.selectedItem = document.getElementById("saveToDisk");
|
||||
else
|
||||
handlerGroup.selectedItem = document.getElementById("openApplication");
|
||||
}
|
||||
this._lastSelectedMode = handlerGroup.selectedItem;
|
||||
|
||||
// Figure out the last selected Save As mode
|
||||
var saveToOptions = document.getElementById("saveToOptions");
|
||||
this._lastSelectedSave = saveToOptions.selectedItem;
|
||||
|
||||
// We don't let users open .exe files or random binary data directly
|
||||
// from the browser at the moment because of security concerns.
|
||||
var mimeType = this._item.mimeInfo.MIMEType;
|
||||
if (mimeType == "application/object-stream" ||
|
||||
mimeType == "application/x-msdownload") {
|
||||
document.getElementById("openApplication").disabled = true;
|
||||
document.getElementById("openDefault").disabled = true;
|
||||
handlerGroup.selectedItem = document.getElementById("saveToDisk");
|
||||
}
|
||||
},
|
||||
|
||||
onAccept: function ()
|
||||
{
|
||||
var contentType = this._item.mimeInfo.MIMEType;
|
||||
var handlerGroup = document.getElementById("handlerGroup");
|
||||
switch (handlerGroup.selectedItem.value) {
|
||||
case "plugin":
|
||||
this._item.handleMode = FILEACTION_OPEN_PLUGIN;
|
||||
var pluginName = document.getElementById("pluginName");
|
||||
this._item.action = this._bundle.getFormattedString("openWith", [pluginName.label]);
|
||||
this._item.pluginEnabled = true;
|
||||
break;
|
||||
case "system":
|
||||
this._item.handledOnlyByPlugin = false;
|
||||
this._item.handleMode = FILEACTION_OPEN_DEFAULT;
|
||||
var defaultDescr = this._item.mimeInfo.defaultDescription;
|
||||
this._item.action = this._bundle.getFormattedString("openWith", [defaultDescr]);
|
||||
break;
|
||||
case "app":
|
||||
this._item.handledOnlyByPlugin = false;
|
||||
this._item.handleMode = FILEACTION_OPEN_CUSTOM;
|
||||
var customApp = document.getElementById("customApp");
|
||||
this._item.action = this._bundle.getFormattedString("openWith", [customApp.label]);
|
||||
break;
|
||||
case "save":
|
||||
this._item.handledOnlyByPlugin = false;
|
||||
this._item.handleMode = FILEACTION_SAVE_TO_DISK;
|
||||
this._item.action = this._bundle.getString("saveToDisk");
|
||||
break;
|
||||
}
|
||||
|
||||
// The opener uses the modifications to the FileAction item to update the
|
||||
// datasource.
|
||||
return true;
|
||||
},
|
||||
|
||||
doEnabling: function (aSelectedItem)
|
||||
{
|
||||
var defaultApp = document.getElementById("defaultApp");
|
||||
var saveToDefault = document.getElementById("saveToDefault");
|
||||
var saveToCustom = document.getElementById("saveToCustom");
|
||||
var customDownloadFolder = document.getElementById("customDownloadFolder");
|
||||
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
|
||||
var saveToAskMe = document.getElementById("saveToAskMe");
|
||||
var pluginName = document.getElementById("pluginName");
|
||||
var changeApp = document.getElementById("changeApp");
|
||||
var customApp = document.getElementById("customApp");
|
||||
|
||||
switch (aSelectedItem.id) {
|
||||
case "openDefault":
|
||||
changeApp.disabled = customApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
|
||||
defaultApp.disabled = false;
|
||||
break;
|
||||
case "openApplication":
|
||||
defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
|
||||
changeApp.disabled = customApp.disabled = false;
|
||||
if (!customApp.file && !this.changeApp()) {
|
||||
this._lastSelectedMode.click();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "saveToDisk":
|
||||
changeApp.disabled = customApp.disabled = defaultApp.disabled = pluginName.disabled = true;
|
||||
var saveToOptions = document.getElementById("saveToOptions");
|
||||
customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = !(saveToOptions.selectedItem.id == "saveToCustom");
|
||||
saveToDefault.disabled = saveToCustom.disabled = saveToAskMe.disabled = false;
|
||||
break;
|
||||
case "plugin":
|
||||
changeApp.disabled = customApp.disabled = defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = true;
|
||||
pluginName.disabled = false;
|
||||
break;
|
||||
}
|
||||
this._lastSelectedMode = aSelectedItem;
|
||||
},
|
||||
|
||||
doSaveToDiskEnabling: function (aSelectedItem)
|
||||
{
|
||||
var isSaveToCustom = aSelectedItem.id == "saveToCustom";
|
||||
var customDownloadFolder = document.getElementById("customDownloadFolder");
|
||||
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
|
||||
chooseCustomDownloadFolder.disabled = customDownloadFolder.disabled = !isSaveToCustom;
|
||||
|
||||
if (isSaveToCustom &&
|
||||
!customDownloadFolder.file && !this.changeCustomFolder()) {
|
||||
this._lastSelectedSave.click();
|
||||
return;
|
||||
}
|
||||
this._lastSelectedSave = aSelectedItem;
|
||||
},
|
||||
|
||||
changeApp: function ()
|
||||
{
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
var winTitle = this._bundle.getString("fpTitleChooseApp");
|
||||
fp.init(window, winTitle, nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterApps);
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
|
||||
var customApp = document.getElementById("customApp");
|
||||
customApp.file = fp.file;
|
||||
this._item.customHandler = fp.file;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
changeCustomFolder: function ()
|
||||
{
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
|
||||
// extract the window title
|
||||
var winTitle = this._bundle.getString("fpTitleChooseDL");
|
||||
fp.init(window, winTitle, nsIFilePicker.modeGetFolder);
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
|
||||
var customDownloadFolder = document.getElementById("customDownloadFolder");
|
||||
customDownloadFolder.file = fp.file;
|
||||
customDownloadFolder.label = fp.file.path;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
|
@ -1,114 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Download Actions Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://browser/locale/preferences/changeaction.dtd">
|
||||
|
||||
<dialog id="ChangeActionDialog" title="&changeAction.title;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="gChangeActionDialog.init();"
|
||||
buttons="accept,cancel,help"
|
||||
ondialogaccept="return gChangeActionDialog.onAccept();"
|
||||
ondialoghelp="openHelp('prefs-file-types', 'chrome://browser/locale/help/help.rdf');"
|
||||
xmlns:aaa="http://www.w3.org/2005/07/aaa"
|
||||
style="width: &window.width;;"
|
||||
persist="screenX screenY">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/actionsshared.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/preferences/changeaction.js"/>
|
||||
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
|
||||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
<hbox id="changeActionHeader" align="center" class="indent">
|
||||
<image id="typeIcon"/>
|
||||
<vbox flex="1">
|
||||
<label id="typeField" crop="right"/>
|
||||
<label id="extensionField" crop="right"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<vbox id="changeActionContent" flex="1">
|
||||
<label control="handlerGroup">&whenDownloading.label;</label>
|
||||
<radiogroup id="handlerGroup" onselect="gChangeActionDialog.doEnabling(this.selectedItem);"
|
||||
flex="1" aaa:describedby="changeActionHeader">
|
||||
<separator class="thin"/>
|
||||
<radio id="openDefault" value="system"
|
||||
label="&openDefault.label;" accesskey="&openDefault.accesskey;"
|
||||
aaa:labelledby="openDefault defaultApp"/>
|
||||
<filefield class="indent" id="defaultApp" disabled="true"/>
|
||||
<separator class="thin"/>
|
||||
<radio id="openApplication" value="app"
|
||||
label="&openApplication.label;" accesskey="&openApplication.accesskey;"
|
||||
aaa:labelledby="openApplication customApp"/>
|
||||
<hbox align="center">
|
||||
<filefield id="customApp" class="indent" flex="1" disabled="true"/>
|
||||
<button id="changeApp" oncommand="gChangeActionDialog.changeApp();"
|
||||
label="&changeApp.label;" accesskey="&changeApp.accesskey;"
|
||||
disabled="true"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<radio id="saveToDisk" value="save"
|
||||
label="&saveToDisk.label;" accesskey="&saveToDisk.accesskey;"/>
|
||||
<radiogroup id="saveToOptions" class="indent" onselect="gChangeActionDialog.doSaveToDiskEnabling(this.selectedItem);"
|
||||
hidden="true">
|
||||
<radio id="saveToDefault" value="default" selected="true"
|
||||
label="&saveToDefaultFolder.label;" accesskey="&saveToDefaultFolder.accesskey;"/>
|
||||
<radio id="saveToCustom" value="custom"
|
||||
label="&saveToThisFolder.label;" accesskey="&saveToThisFolder.accesskey;"
|
||||
aaa:labelledby="saveToCustom customDownloadFolder"/>
|
||||
<hbox align="center" class="indent">
|
||||
<filefield id="customDownloadFolder" flex="1"/>
|
||||
<button id="chooseCustomDownloadFolder" oncommand="gChangeActionDialog.changeCustomFolder();"
|
||||
label="&chooseFolder.label;" accesskey="&chooseFolder.accesskey;"/>
|
||||
</hbox>
|
||||
<radio id="saveToAskMe" value="ask"
|
||||
label="&saveToAskMe.label;" accesskey="&saveToAskMe.accesskey;"/>
|
||||
</radiogroup>
|
||||
<radio id="plugin" value="plugin"
|
||||
label="&usePlugin.label;" accesskey="&usePlugin.accesskey;"
|
||||
aaa:labelledby="plugin pluginName"/>
|
||||
<filefield class="indent" id="pluginName" disabled="true"/>
|
||||
</radiogroup>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
@ -58,7 +58,7 @@ var gContentPane = {
|
|||
/**
|
||||
* 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);
|
||||
|
@ -262,18 +262,6 @@ var gContentPane = {
|
|||
{
|
||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/colors.xul",
|
||||
"", null);
|
||||
},
|
||||
|
||||
// FILE TYPES
|
||||
|
||||
/**
|
||||
* Displays the file type configuration dialog.
|
||||
*/
|
||||
configureFileTypes: function ()
|
||||
{
|
||||
document.documentElement.openWindow("Preferences:DownloadActions",
|
||||
"chrome://browser/content/preferences/downloadactions.xul",
|
||||
"", null);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -73,11 +73,6 @@
|
|||
name="font.language.group"
|
||||
type="wstring"
|
||||
onchange="gContentPane._rebuildFonts();"/>
|
||||
|
||||
<!-- FILE TYPES -->
|
||||
<preference id="pref.downloads.disable_button.edit_actions"
|
||||
name="pref.downloads.disable_button.edit_actions"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
|
||||
|
@ -207,20 +202,6 @@
|
|||
</grid>
|
||||
</groupbox>
|
||||
|
||||
<!-- File Types -->
|
||||
<groupbox id="fileTypesGroup">
|
||||
<caption label="&fileTypes.label;"/>
|
||||
|
||||
<hbox id="configureFileTypesRow" align="center">
|
||||
<description control="manageTypes" flex="1">&configureFileTypes.label;</description>
|
||||
<button id="manageTypes"
|
||||
label="&manage.label;"
|
||||
accesskey="&manage.accesskey;"
|
||||
oncommand="gContentPane.configureFileTypes();"
|
||||
preference="pref.downloads.disable_button.edit_actions"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
</prefpane>
|
||||
|
||||
</overlay>
|
||||
|
|
|
@ -1,870 +0,0 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Download Actions Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
|
||||
const kDisabledPluginTypesPref = "plugin.disable_full_page_plugin_for_types";
|
||||
const kShowPluginsInList = "browser.download.show_plugins_in_list";
|
||||
const kHideTypesWithoutExtensions = "browser.download.hide_plugins_without_extensions";
|
||||
const kRootTypePrefix = "urn:mimetype:";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MIME Types Datasource RDF Utils
|
||||
function NC_URI(aProperty)
|
||||
{
|
||||
return "http://home.netscape.com/NC-rdf#" + aProperty;
|
||||
}
|
||||
|
||||
function MIME_URI(aType)
|
||||
{
|
||||
return "urn:mimetype:" + aType;
|
||||
}
|
||||
|
||||
function HANDLER_URI(aHandler)
|
||||
{
|
||||
return "urn:mimetype:handler:" + aHandler;
|
||||
}
|
||||
|
||||
function APP_URI(aType)
|
||||
{
|
||||
return "urn:mimetype:externalApplication:" + aType;
|
||||
}
|
||||
|
||||
var gDownloadActionsWindow = {
|
||||
_tree : null,
|
||||
_editButton : null,
|
||||
_removeButton : null,
|
||||
_actions : [],
|
||||
_plugins : {},
|
||||
_bundle : null,
|
||||
_pref : Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch),
|
||||
_mimeSvc : Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
|
||||
.getService(Components.interfaces.nsIMIMEService),
|
||||
_excludingPlugins : false,
|
||||
_excludingMissingExtensions : false,
|
||||
|
||||
init: function ()
|
||||
{
|
||||
(this._editButton = document.getElementById("editFileHandler")).disabled = true;
|
||||
(this._removeButton = document.getElementById("removeFileHandler")).disabled = true;
|
||||
|
||||
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
|
||||
this._pref.addObserver(kShowPluginsInList, this, false);
|
||||
this._pref.addObserver(kHideTypesWithoutExtensions, this, false);
|
||||
}
|
||||
|
||||
// Initialize the File Type list
|
||||
this._bundle = document.getElementById("bundlePreferences");
|
||||
this._tree = document.getElementById("fileHandlersList");
|
||||
this._loadView();
|
||||
// Determine any exclusions being applied - e.g. don't show types for which
|
||||
// only a plugin handler exists, don't show types lacking extensions, etc.
|
||||
this._view._rowCount = this._updateExclusions();
|
||||
this._tree.treeBoxObject.view = this._view;
|
||||
|
||||
var indexToSelect = parseInt(this._tree.getAttribute("lastSelected"));
|
||||
if (indexToSelect < this._tree.view.rowCount)
|
||||
this._tree.view.selection.select(indexToSelect);
|
||||
this._tree.focus();
|
||||
},
|
||||
|
||||
_loadView: function ()
|
||||
{
|
||||
// Reset ALL the collections and state flags, because we can call this after
|
||||
// the window has initially displayed by resetting the filter.
|
||||
this._actions = [];
|
||||
this._plugins = {};
|
||||
this._view._filtered = false;
|
||||
this._view._filterSet = [];
|
||||
this._view._usingExclusionSet = false;
|
||||
this._view._exclusionSet = [];
|
||||
this._view._filterValue = "";
|
||||
|
||||
this._loadPluginData();
|
||||
this._loadMIMERegistryData();
|
||||
},
|
||||
|
||||
_updateRowCount: function (aNewRowCount)
|
||||
{
|
||||
var oldCount = this._view._rowCount;
|
||||
this._view._rowCount = 0;
|
||||
this._tree.treeBoxObject.rowCountChanged(0, -oldCount);
|
||||
this._view._rowCount = aNewRowCount;
|
||||
this._tree.treeBoxObject.rowCountChanged(0, aNewRowCount);
|
||||
},
|
||||
|
||||
uninit: function ()
|
||||
{
|
||||
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
|
||||
this._pref.removeObserver(kShowPluginsInList, this);
|
||||
this._pref.removeObserver(kHideTypesWithoutExtensions, this);
|
||||
}
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "nsPref:changed" &&
|
||||
(aData == kShowPluginsInList || aData == kHideTypesWithoutExtensions))
|
||||
this._updateRowCount(this._updateExclusions());
|
||||
},
|
||||
|
||||
_updateExclusions: function ()
|
||||
{
|
||||
this._excludingPlugins = !this._pref.getBoolPref(kShowPluginsInList);
|
||||
this._excludingMissingExtensions = this._pref.getBoolPref(kHideTypesWithoutExtensions);
|
||||
this._view._exclusionSet = [].concat(this._actions);
|
||||
if (this._excludingMissingExtensions) {
|
||||
this._view._usingExclusionSet = true;
|
||||
for (var i = 0; i < this._view._exclusionSet.length;) {
|
||||
if (!this._view._exclusionSet[i].hasExtension)
|
||||
this._view._exclusionSet.splice(i, 1);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (this._excludingPlugins) {
|
||||
this._view._usingExclusionSet = true;
|
||||
for (i = 0; i < this._view._exclusionSet.length;) {
|
||||
if (this._view._exclusionSet[i].handledOnlyByPlugin)
|
||||
this._view._exclusionSet.splice(i, 1);
|
||||
else
|
||||
++i
|
||||
}
|
||||
}
|
||||
|
||||
return this._view._usingExclusionSet ? this._view._exclusionSet.length
|
||||
: this._view._filtered ? this._view._filterSet.length
|
||||
: this._actions.length;
|
||||
},
|
||||
|
||||
_loadPluginData: function ()
|
||||
{
|
||||
// Read enabled plugin type information from the category manager
|
||||
var disabled = "";
|
||||
if (this._pref.prefHasUserValue(kDisabledPluginTypesPref))
|
||||
disabled = this._pref.getCharPref(kDisabledPluginTypesPref);
|
||||
|
||||
for (var i = 0; i < navigator.plugins.length; ++i) {
|
||||
var plugin = navigator.plugins[i];
|
||||
for (var j = 0; j < plugin.length; ++j) {
|
||||
var actionName = this._bundle.getFormattedString("openWith", [plugin.name])
|
||||
var type = plugin[j].type;
|
||||
this._createAction(type, actionName, true, FILEACTION_OPEN_PLUGIN,
|
||||
null, true, disabled.indexOf(type) == -1, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_createAction: function (aMIMEType, aActionName,
|
||||
aIsEditable, aHandleMode, aCustomHandler,
|
||||
aPluginAvailable, aPluginEnabled,
|
||||
aHandledOnlyByPlugin)
|
||||
{
|
||||
var newAction = !(aMIMEType in this._plugins);
|
||||
var action = newAction ? new FileAction() : this._plugins[aMIMEType];
|
||||
action.type = aMIMEType;
|
||||
var info = this._mimeSvc.getFromTypeAndExtension(action.type, null);
|
||||
|
||||
// File Extension
|
||||
try {
|
||||
action.extension = info.primaryExtension;
|
||||
}
|
||||
catch (e) {
|
||||
action.extension = this._bundle.getString("extensionNone");
|
||||
action.hasExtension = false;
|
||||
}
|
||||
|
||||
// Large and Small Icon
|
||||
try {
|
||||
action.smallIcon = "moz-icon://goat." + info.primaryExtension + "?size=16";
|
||||
action.bigIcon = "moz-icon://goat." + info.primaryExtension + "?size=32";
|
||||
}
|
||||
catch (e) {
|
||||
action.smallIcon = "moz-icon://goat?size=16&contentType=" + info.MIMEType;
|
||||
action.bigIcon = "moz-icon://goat?contentType=" + info.MIMEType + "&size=32";
|
||||
}
|
||||
|
||||
// Pretty Type Name
|
||||
if (info.description == "") {
|
||||
try {
|
||||
action.typeName = this._bundle.getFormattedString("fileEnding", [info.primaryExtension.toUpperCase()]);
|
||||
}
|
||||
catch (e) {
|
||||
// Wow, this sucks, just show the MIME type as a last ditch effort to display
|
||||
// the type of file that this is.
|
||||
action.typeName = info.MIMEType;
|
||||
}
|
||||
}
|
||||
else
|
||||
action.typeName = info.description;
|
||||
|
||||
// Pretty Action Name
|
||||
if (aActionName)
|
||||
action.action = aActionName;
|
||||
action.pluginAvailable = aPluginAvailable;
|
||||
action.pluginEnabled = aPluginEnabled;
|
||||
action.editable = aIsEditable;
|
||||
action.handleMode = aHandleMode;
|
||||
action.customHandler = aCustomHandler;
|
||||
action.mimeInfo = info;
|
||||
action.handledOnlyByPlugin = aHandledOnlyByPlugin
|
||||
|
||||
if (newAction && !(action.handledOnlyByPlugin && !action.pluginEnabled)) {
|
||||
this._actions.push(action);
|
||||
this._plugins[action.type] = action;
|
||||
}
|
||||
return action;
|
||||
},
|
||||
|
||||
_loadMIMEDS: function ()
|
||||
{
|
||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
|
||||
var file = fileLocator.get("UMimTyp", Components.interfaces.nsIFile);
|
||||
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var fileHandler = ioService.getProtocolHandler("file")
|
||||
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
||||
this._mimeDS = this._rdf.GetDataSourceBlocking(fileHandler.getURLSpecFromFile(file));
|
||||
},
|
||||
|
||||
_getLiteralValue: function (aResource, aProperty)
|
||||
{
|
||||
var property = this._rdf.GetResource(NC_URI(aProperty));
|
||||
var value = this._mimeDS.GetTarget(aResource, property, true);
|
||||
if (value)
|
||||
return value.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
return "";
|
||||
},
|
||||
|
||||
_getChildResource: function (aResource, aProperty)
|
||||
{
|
||||
var property = this._rdf.GetResource(NC_URI(aProperty));
|
||||
return this._mimeDS.GetTarget(aResource, property, true);
|
||||
},
|
||||
|
||||
_getDisplayNameForFile: function (aFile)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
if (aFile instanceof Components.interfaces.nsILocalFileWin) {
|
||||
try {
|
||||
return aFile.getVersionInfoField("FileDescription");
|
||||
}
|
||||
catch (e) {
|
||||
// fall through to the filename
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac);
|
||||
try {
|
||||
return lfm.bundleDisplayName;
|
||||
}
|
||||
catch (e) {
|
||||
// fall through to the file name
|
||||
}
|
||||
#endif
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
|
||||
return url.fileName;
|
||||
},
|
||||
|
||||
_loadMIMERegistryData: function ()
|
||||
{
|
||||
this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
this._loadMIMEDS();
|
||||
|
||||
var root = this._rdf.GetResource("urn:mimetypes:root");
|
||||
var container = Components.classes["@mozilla.org/rdf/container;1"]
|
||||
.createInstance(Components.interfaces.nsIRDFContainer);
|
||||
container.Init(this._mimeDS, root);
|
||||
|
||||
var elements = container.GetElements();
|
||||
while (elements.hasMoreElements()) {
|
||||
var type = elements.getNext();
|
||||
if (!(type instanceof Components.interfaces.nsIRDFResource))
|
||||
break;
|
||||
var editable = this._getLiteralValue(type, "editable") == "true";
|
||||
if (!editable)
|
||||
continue;
|
||||
|
||||
var handler = this._getChildResource(type, "handlerProp");
|
||||
var alwaysAsk = this._getLiteralValue(handler, "alwaysAsk") == "true";
|
||||
if (alwaysAsk)
|
||||
continue;
|
||||
var saveToDisk = this._getLiteralValue(handler, "saveToDisk") == "true";
|
||||
var useSystemDefault = this._getLiteralValue(handler, "useSystemDefault") == "true";
|
||||
var editable = this._getLiteralValue(type, "editable") == "true";
|
||||
var handledInternally = this._getLiteralValue(handler, "handleInternal") == "true";
|
||||
var externalApp = this._getChildResource(handler, "externalApplication");
|
||||
var externalAppPath = this._getLiteralValue(externalApp, "path");
|
||||
try {
|
||||
var customHandler = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
customHandler.initWithPath(externalAppPath);
|
||||
}
|
||||
catch (e) {
|
||||
customHandler = null;
|
||||
}
|
||||
if (customHandler && !customHandler.exists())
|
||||
customHandler = null;
|
||||
var mimeType = this._getLiteralValue(type, "value");
|
||||
var typeInfo = this._mimeSvc.getFromTypeAndExtension(mimeType, null);
|
||||
|
||||
// Determine the pretty name of the associated action.
|
||||
var actionName = "";
|
||||
var handleMode = 0;
|
||||
if (saveToDisk) {
|
||||
// Save the file to disk
|
||||
actionName = this._bundle.getString("saveToDisk");
|
||||
handleMode = FILEACTION_SAVE_TO_DISK;
|
||||
}
|
||||
else if (useSystemDefault) {
|
||||
// Use the System Default handler
|
||||
actionName = this._bundle.getFormattedString("openWith",
|
||||
[typeInfo.defaultDescription]);
|
||||
handleMode = FILEACTION_OPEN_DEFAULT;
|
||||
}
|
||||
else {
|
||||
// Custom Handler
|
||||
if (customHandler) {
|
||||
actionName = this._bundle.getFormattedString("openWith",
|
||||
[this._getDisplayNameForFile(customHandler)]);
|
||||
handleMode = FILEACTION_OPEN_CUSTOM;
|
||||
}
|
||||
else {
|
||||
// Corrupt datasource, invalid custom handler path. Revert to default.
|
||||
actionName = this._bundle.getFormattedString("openWith",
|
||||
[typeInfo.defaultDescription]);
|
||||
handleMode = FILEACTION_OPEN_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (handledInternally)
|
||||
handleMode = FILEACTION_OPEN_INTERNALLY;
|
||||
|
||||
var pluginAvailable = mimeType in this._plugins && this._plugins[mimeType].pluginAvailable;
|
||||
var pluginEnabled = pluginAvailable && this._plugins[mimeType].pluginEnabled;
|
||||
if (pluginEnabled) {
|
||||
handleMode = FILEACTION_OPEN_PLUGIN;
|
||||
actionName = null;
|
||||
}
|
||||
var action = this._createAction(mimeType, actionName, editable, handleMode,
|
||||
customHandler, pluginAvailable, pluginEnabled,
|
||||
false);
|
||||
}
|
||||
},
|
||||
|
||||
_view: {
|
||||
_filtered : false,
|
||||
_filterSet : [],
|
||||
_usingExclusionSet : false,
|
||||
_exclusionSet : [],
|
||||
_filterValue : "",
|
||||
|
||||
_rowCount: 0,
|
||||
get rowCount()
|
||||
{
|
||||
return this._rowCount;
|
||||
},
|
||||
|
||||
get activeCollection ()
|
||||
{
|
||||
return this._filtered ? this._filterSet
|
||||
: this._usingExclusionSet ? this._exclusionSet
|
||||
: gDownloadActionsWindow._actions;
|
||||
},
|
||||
|
||||
getItemAtIndex: function (aIndex)
|
||||
{
|
||||
return this.activeCollection[aIndex];
|
||||
},
|
||||
|
||||
getCellText: function (aIndex, aColumn)
|
||||
{
|
||||
switch (aColumn.id) {
|
||||
case "fileExtension":
|
||||
return this.getItemAtIndex(aIndex).extension.toUpperCase();
|
||||
case "fileType":
|
||||
return this.getItemAtIndex(aIndex).typeName;
|
||||
case "fileMIMEType":
|
||||
return this.getItemAtIndex(aIndex).type;
|
||||
case "fileHandler":
|
||||
return this.getItemAtIndex(aIndex).action;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
getImageSrc: function (aIndex, aColumn)
|
||||
{
|
||||
if (aColumn.id == "fileExtension")
|
||||
return this.getItemAtIndex(aIndex).smallIcon;
|
||||
return "";
|
||||
},
|
||||
_selection: null,
|
||||
get selection () { return this._selection; },
|
||||
set selection (val) { this._selection = val; return val; },
|
||||
getRowProperties: function (aIndex, aProperties) {},
|
||||
getCellProperties: function (aIndex, aColumn, aProperties) {},
|
||||
getColumnProperties: function (aColumn, aProperties) {},
|
||||
isContainer: function (aIndex) { return false; },
|
||||
isContainerOpen: function (aIndex) { return false; },
|
||||
isContainerEmpty: function (aIndex) { return false; },
|
||||
isSeparator: function (aIndex) { return false; },
|
||||
isSorted: function (aIndex) { return false; },
|
||||
canDrop: function (aIndex, aOrientation) { return false; },
|
||||
drop: function (aIndex, aOrientation) {},
|
||||
getParentIndex: function (aIndex) { return -1; },
|
||||
hasNextSibling: function (aParentIndex, aIndex) { return false; },
|
||||
getLevel: function (aIndex) { return 0; },
|
||||
getProgressMode: function (aIndex, aColumn) {},
|
||||
getCellValue: function (aIndex, aColumn) {},
|
||||
setTree: function (aTree) {},
|
||||
toggleOpenState: function (aIndex) { },
|
||||
cycleHeader: function (aColumn) {},
|
||||
selectionChanged: function () {},
|
||||
cycleCell: function (aIndex, aColumn) {},
|
||||
isEditable: function (aIndex, aColumn) { return false; },
|
||||
isSelectable: function (aIndex, aColumn) { return false; },
|
||||
setCellValue: function (aIndex, aColumn, aValue) {},
|
||||
setCellText: function (aIndex, aColumn, aValue) {},
|
||||
performAction: function (aAction) {},
|
||||
performActionOnRow: function (aAction, aIndex) {},
|
||||
performActionOnCell: function (aAction, aindex, aColumn) {}
|
||||
},
|
||||
|
||||
removeFileHandler: function ()
|
||||
{
|
||||
var selection = this._tree.view.selection;
|
||||
if (selection.count < 1)
|
||||
return;
|
||||
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0;
|
||||
flags += promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1;
|
||||
|
||||
var title = this._bundle.getString("removeTitle" + (selection.count > 1 ? "Multiple" : "Single"));
|
||||
var message = this._bundle.getString("removeMessage" + (selection.count > 1 ? "Multiple" : "Single"));
|
||||
var button = this._bundle.getString("removeButton" + (selection.count > 1 ? "Multiple" : "Single"));
|
||||
var rv = promptService.confirmEx(window, title, message, flags, button,
|
||||
null, null, null, { value: 0 });
|
||||
if (rv != 0)
|
||||
return;
|
||||
|
||||
var rangeCount = selection.getRangeCount();
|
||||
var lastSelected = 0;
|
||||
var mimeDSDirty = false;
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
var min = { }; var max = { };
|
||||
selection.getRangeAt(i, min, max);
|
||||
for (var j = min.value; j <= max.value; ++j) {
|
||||
var item = this._view.getItemAtIndex(j);
|
||||
if (!item.handledOnlyByPlugin) {
|
||||
// There is data for this type in the MIME registry, so make sure we
|
||||
// remove it from the MIME registry. We don't disable the plugin here because
|
||||
// if we do there's currently no way through the UI to re-enable it. We may
|
||||
// come up with some sort of solution for that at a later date.
|
||||
var typeRes = this._rdf.GetResource(MIME_URI(item.type));
|
||||
var handlerRes = this._getChildResource(typeRes, "handlerProp");
|
||||
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
|
||||
this._cleanResource(extAppRes);
|
||||
this._cleanResource(handlerRes);
|
||||
this._cleanResource(typeRes);
|
||||
mimeDSDirty = true;
|
||||
}
|
||||
lastSelected = (j + 1) >= this._view.rowCount ? j-1 : j;
|
||||
}
|
||||
}
|
||||
if (mimeDSDirty &&
|
||||
this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
|
||||
this._mimeDS.Flush();
|
||||
|
||||
// Just reload the list to make sure deletions are respected
|
||||
this._loadView();
|
||||
this._updateRowCount(this._updateExclusions());
|
||||
|
||||
selection.select(lastSelected);
|
||||
},
|
||||
|
||||
_cleanResource: function (aResource)
|
||||
{
|
||||
var labels = this._mimeDS.ArcLabelsOut(aResource);
|
||||
while (labels.hasMoreElements()) {
|
||||
var arc = labels.getNext();
|
||||
if (!(arc instanceof Components.interfaces.nsIRDFResource))
|
||||
break;
|
||||
var target = this._mimeDS.GetTarget(aResource, arc, true);
|
||||
this._mimeDS.Unassert(aResource, arc, target);
|
||||
}
|
||||
},
|
||||
|
||||
_disablePluginForItem: function (aItem)
|
||||
{
|
||||
if (aItem.pluginAvailable) {
|
||||
// Since we're disabling the full page plugin for this content type,
|
||||
// we must add it to the disabled list if it's not in there already.
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var disabled = aItem.type;
|
||||
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
|
||||
disabled = prefs.getCharPref(kDisabledPluginTypesPref);
|
||||
if (disabled.indexOf(aItem.type) == -1)
|
||||
disabled += "," + aItem.type;
|
||||
}
|
||||
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
|
||||
|
||||
// Also, we update the category manager so that existing browser windows
|
||||
// update.
|
||||
var catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(Components.interfaces.nsICategoryManager);
|
||||
catman.deleteCategoryEntry("Gecko-Content-Viewers", aItem.type, false);
|
||||
}
|
||||
},
|
||||
|
||||
_enablePluginForItem: function (aItem)
|
||||
{
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
// Since we're enabling the full page plugin for this content type, we must
|
||||
// look at the disabled types list and ensure that this type isn't in it.
|
||||
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
|
||||
var disabledList = prefs.getCharPref(kDisabledPluginTypesPref);
|
||||
if (disabledList == aItem.type)
|
||||
prefs.clearUserPref(kDisabledPluginTypesPref);
|
||||
else {
|
||||
var disabledTypes = disabledList.split(",");
|
||||
var disabled = "";
|
||||
for (var i = 0; i < disabledTypes.length; ++i) {
|
||||
if (aItem.type != disabledTypes[i])
|
||||
disabled += disabledTypes[i] + (i == disabledTypes.length - 1 ? "" : ",");
|
||||
}
|
||||
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
|
||||
}
|
||||
}
|
||||
|
||||
// Also, we update the category manager so that existing browser windows
|
||||
// update.
|
||||
var catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(Components.interfaces.nsICategoryManager);
|
||||
catman.addCategoryEntry("Gecko-Content-Viewers", aItem.type,
|
||||
kPluginHandlerContractID, false, true);
|
||||
},
|
||||
|
||||
_ensureMIMERegistryEntry: function (aItem)
|
||||
{
|
||||
var root = this._rdf.GetResource("urn:mimetypes:root");
|
||||
var container = Components.classes["@mozilla.org/rdf/container;1"]
|
||||
.createInstance(Components.interfaces.nsIRDFContainer);
|
||||
container.Init(this._mimeDS, root);
|
||||
|
||||
var itemResource = this._rdf.GetResource(MIME_URI(aItem.type));
|
||||
var handlerResource = null;
|
||||
if (container.IndexOf(itemResource) == -1) {
|
||||
container.AppendElement(itemResource);
|
||||
this._setLiteralValue(itemResource, "editable", "true");
|
||||
this._setLiteralValue(itemResource, "value", aItem.type);
|
||||
|
||||
handlerResource = this._rdf.GetResource(HANDLER_URI(aItem.type));
|
||||
this._setLiteralValue(handlerResource, "alwaysAsk", "false");
|
||||
var handlerProp = this._rdf.GetResource(NC_URI("handlerProp"));
|
||||
this._mimeDS.Assert(itemResource, handlerProp, handlerResource, true);
|
||||
|
||||
var extAppResource = this._rdf.GetResource(APP_URI(aItem.type));
|
||||
this._setLiteralValue(extAppResource, "path", "");
|
||||
var extAppProp = this._rdf.GetResource(NC_URI("externalApplication"));
|
||||
this._mimeDS.Assert(handlerResource, extAppProp, extAppResource, true);
|
||||
}
|
||||
else
|
||||
handlerResource = this._getChildResource(itemResource, "handlerProp");
|
||||
|
||||
return handlerResource;
|
||||
},
|
||||
|
||||
_setLiteralValue: function (aResource, aProperty, aValue)
|
||||
{
|
||||
var property = this._rdf.GetResource(NC_URI(aProperty));
|
||||
var newValue = this._rdf.GetLiteral(aValue);
|
||||
var oldValue = this._mimeDS.GetTarget(aResource, property, true);
|
||||
if (oldValue)
|
||||
this._mimeDS.Change(aResource, property, oldValue, newValue);
|
||||
else
|
||||
this._mimeDS.Assert(aResource, property, newValue, true);
|
||||
},
|
||||
|
||||
editFileHandler: function ()
|
||||
{
|
||||
var selection = this._tree.view.selection;
|
||||
if (selection.count != 1)
|
||||
return;
|
||||
|
||||
var item = this._view.getItemAtIndex(selection.currentIndex);
|
||||
openDialog("chrome://browser/content/preferences/changeaction.xul",
|
||||
"_blank", "modal,centerscreen", item);
|
||||
|
||||
// Update the database
|
||||
switch (item.handleMode) {
|
||||
case FILEACTION_OPEN_PLUGIN:
|
||||
this._enablePluginForItem(item);
|
||||
// We don't need to adjust the database because plugin settings always
|
||||
// supercede whatever is in the db, leaving it untouched allows the last
|
||||
// user setting(s) to be preserved if they ever revert.
|
||||
break;
|
||||
case FILEACTION_OPEN_DEFAULT:
|
||||
this._disablePluginForItem(item);
|
||||
var handlerRes = this._ensureMIMERegistryEntry(item);
|
||||
this._setLiteralValue(handlerRes, "useSystemDefault", "true");
|
||||
this._setLiteralValue(handlerRes, "saveToDisk", "false");
|
||||
break;
|
||||
case FILEACTION_OPEN_CUSTOM:
|
||||
this._disablePluginForItem(item);
|
||||
var handlerRes = this._ensureMIMERegistryEntry(item);
|
||||
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
|
||||
this._setLiteralValue(handlerRes, "saveToDisk", "false");
|
||||
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
|
||||
this._setLiteralValue(extAppRes, "path", item.customHandler.path);
|
||||
break;
|
||||
case FILEACTION_SAVE_TO_DISK:
|
||||
this._disablePluginForItem(item);
|
||||
var handlerRes = this._ensureMIMERegistryEntry(item);
|
||||
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
|
||||
this._setLiteralValue(handlerRes, "saveToDisk", "true");
|
||||
break;
|
||||
}
|
||||
|
||||
if (this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
|
||||
this._mimeDS.Flush();
|
||||
|
||||
// Update the view
|
||||
this._tree.treeBoxObject.invalidateRow(selection.currentIndex);
|
||||
},
|
||||
|
||||
onSelectionChanged: function ()
|
||||
{
|
||||
if (this._tree.view.rowCount == 0) {
|
||||
this._removeButton.disabled = true;
|
||||
this._editButton.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var selection = this._tree.view.selection;
|
||||
var selected = selection.count;
|
||||
this._removeButton.disabled = selected == 0;
|
||||
this._editButton.disabled = selected != 1;
|
||||
var stringKey = selected > 1 ? "removeButtonMultiple" : "removeButtonSingle";
|
||||
this._removeButton.label = this._bundle.getString(stringKey);
|
||||
|
||||
var canRemove = true;
|
||||
var canEdit = true;
|
||||
|
||||
var rangeCount = selection.getRangeCount();
|
||||
var min = { }, max = { };
|
||||
var setLastSelected = false;
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
selection.getRangeAt(i, min, max);
|
||||
|
||||
for (var j = min.value; j <= max.value; ++j) {
|
||||
if (!setLastSelected) {
|
||||
// Set the last selected index to the first item in the selection
|
||||
this._tree.setAttribute("lastSelected", j);
|
||||
setLastSelected = true;
|
||||
}
|
||||
|
||||
var item = this._view.getItemAtIndex(j);
|
||||
if (item &&
|
||||
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY))
|
||||
canEdit = false;
|
||||
|
||||
if (item &&
|
||||
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY ||
|
||||
item.handledOnlyByPlugin))
|
||||
canRemove = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!canRemove)
|
||||
this._removeButton.disabled = true;
|
||||
if (!canEdit)
|
||||
this._editButton.disabled = true;
|
||||
},
|
||||
|
||||
_lastSortProperty : "",
|
||||
_lastSortAscending: false,
|
||||
sort: function (aProperty)
|
||||
{
|
||||
var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
|
||||
function sortByProperty(a, b)
|
||||
{
|
||||
return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
|
||||
}
|
||||
function sortByExtension(a, b)
|
||||
{
|
||||
if (!a.hasExtension && b.hasExtension)
|
||||
return 1;
|
||||
if (!b.hasExtension && a.hasExtension)
|
||||
return -1;
|
||||
return a.extension.toLowerCase().localeCompare(b.extension.toLowerCase());
|
||||
}
|
||||
// Sort the Filtered List, if in Filtered mode
|
||||
if (!this._view._filtered) {
|
||||
this._view.activeCollection.sort(aProperty == "extension" ? sortByExtension : sortByProperty);
|
||||
if (!ascending)
|
||||
this._view.activeCollection.reverse();
|
||||
}
|
||||
|
||||
this._view.selection.clearSelection();
|
||||
this._view.selection.select(0);
|
||||
this._tree.treeBoxObject.invalidate();
|
||||
this._tree.treeBoxObject.ensureRowIsVisible(0);
|
||||
|
||||
this._lastSortAscending = ascending;
|
||||
this._lastSortProperty = aProperty;
|
||||
},
|
||||
|
||||
clearFilter: function ()
|
||||
{
|
||||
// Clear the Filter and the Tree Display
|
||||
document.getElementById("filter").value = "";
|
||||
this._view._filtered = false;
|
||||
this._view._filterSet = [];
|
||||
|
||||
// Just reload the list to make sure deletions are respected
|
||||
this._loadView();
|
||||
this._updateRowCount(this._updateExclusions());
|
||||
|
||||
// Restore selection
|
||||
this._view.selection.clearSelection();
|
||||
for (var i = 0; i < this._lastSelectedRanges.length; ++i) {
|
||||
var range = this._lastSelectedRanges[i];
|
||||
this._view.selection.rangedSelect(range.min, range.max, true);
|
||||
}
|
||||
this._lastSelectedRanges = [];
|
||||
|
||||
document.getElementById("actionsIntro").value = this._bundle.getString("actionsAll");
|
||||
document.getElementById("clearFilter").disabled = true;
|
||||
document.getElementById("filter").focus();
|
||||
},
|
||||
|
||||
_actionMatchesFilter: function (aAction)
|
||||
{
|
||||
return aAction.extension.toLowerCase().indexOf(this._view._filterValue) != -1 ||
|
||||
aAction.typeName.toLowerCase().indexOf(this._view._filterValue) != -1 ||
|
||||
aAction.type.toLowerCase().indexOf(this._view._filterValue) != -1 ||
|
||||
aAction.action.toLowerCase().indexOf(this._view._filterValue) != -1;
|
||||
},
|
||||
|
||||
_filterActions: function (aFilterValue)
|
||||
{
|
||||
this._view._filterValue = aFilterValue;
|
||||
var actions = [];
|
||||
var collection = this._view._usingExclusionSet ? this._view._exclusionSet : this._actions;
|
||||
for (var i = 0; i < collection.length; ++i) {
|
||||
var action = collection[i];
|
||||
if (this._actionMatchesFilter(action))
|
||||
actions.push(action);
|
||||
}
|
||||
return actions;
|
||||
},
|
||||
|
||||
_lastSelectedRanges: [],
|
||||
_saveState: function ()
|
||||
{
|
||||
// Save selection
|
||||
var seln = this._view.selection;
|
||||
this._lastSelectedRanges = [];
|
||||
var rangeCount = seln.getRangeCount();
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
var min = {}; var max = {};
|
||||
seln.getRangeAt(i, min, max);
|
||||
this._lastSelectedRanges.push({ min: min.value, max: max.value });
|
||||
}
|
||||
},
|
||||
|
||||
_filterTimeout: -1,
|
||||
onFilterInput: function ()
|
||||
{
|
||||
if (this._filterTimeout != -1)
|
||||
clearTimeout(this._filterTimeout);
|
||||
|
||||
function filterActions()
|
||||
{
|
||||
var filter = document.getElementById("filter").value.toLowerCase();
|
||||
if (filter == "") {
|
||||
gDownloadActionsWindow.clearFilter();
|
||||
return;
|
||||
}
|
||||
var view = gDownloadActionsWindow._view;
|
||||
view._filterSet = gDownloadActionsWindow._filterActions(filter);
|
||||
if (!view._filtered) {
|
||||
// Save Display Info for the Non-Filtered mode when we first
|
||||
// enter Filtered mode.
|
||||
gDownloadActionsWindow._saveState();
|
||||
view._filtered = true;
|
||||
}
|
||||
|
||||
// Clear the display
|
||||
gDownloadActionsWindow._updateRowCount(view._filterSet.length);
|
||||
|
||||
// if the view is not empty then select the first item
|
||||
if (view.rowCount > 0)
|
||||
view.selection.select(0);
|
||||
|
||||
document.getElementById("actionsIntro").value = gDownloadActionsWindow._bundle.getString("actionsFiltered");
|
||||
document.getElementById("clearFilter").disabled = false;
|
||||
}
|
||||
window.filterActions = filterActions;
|
||||
this._filterTimeout = setTimeout("filterActions();", 500);
|
||||
},
|
||||
|
||||
onFilterKeyPress: function (aEvent)
|
||||
{
|
||||
if (aEvent.keyCode == 27) // ESC key
|
||||
this.clearFilter();
|
||||
},
|
||||
|
||||
focusFilterBox: function ()
|
||||
{
|
||||
var filter = document.getElementById("filter");
|
||||
filter.focus();
|
||||
filter.select();
|
||||
}
|
||||
};
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Firefox Preferences System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
|
||||
<!DOCTYPE prefwindow [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % downloadactionsDTD SYSTEM "chrome://browser/locale/preferences/downloadactions.dtd">
|
||||
%brandDTD;
|
||||
%downloadactionsDTD;
|
||||
]>
|
||||
|
||||
<window id="DownloadActionsWindow" class="windowDialog"
|
||||
windowtype="Preferences:DownloadActions"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="gDownloadActionsWindow.init();"
|
||||
onunload="gDownloadActionsWindow.uninit();"
|
||||
title="&downloadactionsWindow.title;"
|
||||
width="&window.width;" height="&window.height;" persist="width height screenX screenY">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/actionsshared.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/preferences/downloadactions.js"/>
|
||||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
|
||||
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
|
||||
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
|
||||
</keyset>
|
||||
|
||||
<vbox flex="1" class="contentPane">
|
||||
<hbox align="center">
|
||||
<label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
|
||||
<textbox id="filter" flex="1" oninput="gDownloadActionsWindow.onFilterInput();"
|
||||
onkeypress="gDownloadActionsWindow.onFilterKeyPress(event);"/>
|
||||
<button id="clearFilter" icon="clear" label="&clear.label;" accesskey="&clear.accesskey;"
|
||||
oncommand="gDownloadActionsWindow.clearFilter();" disabled="true"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<label id="actionsIntro" control="fileHandlersList">
|
||||
&fileTypesDescription.label;
|
||||
</label>
|
||||
<separator class="thin"/>
|
||||
<tree id="fileHandlersList" flex="1"
|
||||
lastSelected="0" persist="lastSelected"
|
||||
onselect="gDownloadActionsWindow.onSelectionChanged();"
|
||||
ondblclick="gDownloadActionsWindow.editFileHandler();">
|
||||
<treechildren id="extensionChildren"/>
|
||||
<treecols>
|
||||
<treecol id="fileExtension" ignoreincolumnpicker="true"
|
||||
class="sortDirectionIndicator" persist="width"
|
||||
label="&fileExtensionColumn.label;" accesskey="&fileExtensionColumn.accesskey;"
|
||||
onclick="gDownloadActionsWindow.sort('extension');"/>
|
||||
<treecol id="fileType" flex="1"
|
||||
class="sortDirectionIndicator" persist="width"
|
||||
label="&fileTypeColumn.label;" accesskey="&fileTypeColumn.accesskey;"
|
||||
onclick="gDownloadActionsWindow.sort('typeName');"/>
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="fileMIMEType" flex="1" hidden="true"
|
||||
class="sortDirectionIndicator" persist="width"
|
||||
label="&fileMIMETypeColumn.label;" accesskey="&fileMIMETypeColumn.accesskey;"
|
||||
onclick="gDownloadActionsWindow.sort('type');"/>
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="fileHandler" flex="1"
|
||||
class="sortDirectionIndicator" persist="width"
|
||||
label="&fileHandlerColumn.label;" accesskey="&fileHandlerColumn.accesskey;"
|
||||
onclick="gDownloadActionsWindow.sort('action');"/>
|
||||
<splitter class="tree-splitter" />
|
||||
</treecols>
|
||||
</tree>
|
||||
</vbox>
|
||||
<separator class="thin"/>
|
||||
<hbox>
|
||||
<hbox flex="1" class="actionButtons">
|
||||
<button id="removeFileHandler" icon="remove"
|
||||
label="&remove.label;" accesskey="&remove.accesskey;"
|
||||
oncommand="gDownloadActionsWindow.removeFileHandler();"/>
|
||||
<button id="editFileHandler"
|
||||
label="&edit.label;" accesskey="&edit.accesskey;"
|
||||
oncommand="gDownloadActionsWindow.editFileHandler();"/>
|
||||
<spacer flex="1"/>
|
||||
#ifndef XP_MACOSX
|
||||
<button oncommand="close();" icon="close"
|
||||
label="&button.close.label;" accesskey="&button.close.accesskey;"/>
|
||||
#endif
|
||||
</hbox>
|
||||
<resizer dir="bottomright"/>
|
||||
</hbox>
|
||||
</window>
|
||||
|
|
@ -1,383 +0,0 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Firefox Preferences System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Jeff Walden <jwalden+code@mit.edu>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Asaf Romano <mozilla.mano@sent.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cr = Components.results;
|
||||
var TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Preferences:
|
||||
*
|
||||
* browser.feeds.handler
|
||||
* - "bookmarks", "reader" (clarified further using the .default preference),
|
||||
* or "ask" -- indicates the default handler being used to process feeds
|
||||
*
|
||||
* browser.feeds.handler.default
|
||||
* - "bookmarks", "client" or "web" -- indicates the chosen feed reader used
|
||||
* to display feeds, either transiently (i.e., when the "use as default"
|
||||
* checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
|
||||
* or more permanently (i.e., the item displayed in the dropdown in Feeds
|
||||
* preferences)
|
||||
*
|
||||
* browser.feeds.handler.webservice
|
||||
* - the URL of the currently selected web service used to read feeds
|
||||
*
|
||||
* browser.feeds.handlers.application
|
||||
* - nsILocalFile, stores the current client-side feed reading app if one has
|
||||
* been chosen
|
||||
*/
|
||||
|
||||
const PREF_SELECTED_APP = "browser.feeds.handlers.application";
|
||||
const PREF_SELECTED_WEB = "browser.feeds.handlers.webservice";
|
||||
const PREF_SELECTED_ACTION = "browser.feeds.handler";
|
||||
const PREF_SELECTED_READER = "browser.feeds.handler.default";
|
||||
|
||||
var gFeedsPane = {
|
||||
element: function(aID) {
|
||||
return document.getElementById(aID);
|
||||
},
|
||||
|
||||
/* ........ QueryInterface .............. */
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Ci.nsISupports) ||
|
||||
aIID.equals(Ci.nsIObserver) ||
|
||||
aIID.equals(Ci.nsIDOMEventListener))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIObserver
|
||||
*/
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != "nsPref:changed" || aData != PREF_SELECTED_WEB)
|
||||
return;
|
||||
|
||||
if (this.element(PREF_SELECTED_ACTION).value == "reader") {
|
||||
var wccr =
|
||||
Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
|
||||
getService(Ci.nsIWebContentConverterService);
|
||||
var handlerURL = this.element(PREF_SELECTED_WEB).valueFromPreferences;
|
||||
var handler =
|
||||
wccr.getWebContentHandlerByURI(TYPE_MAYBE_FEED, handlerURL);
|
||||
if (handler)
|
||||
wccr.setAutoHandler(TYPE_MAYBE_FEED, handler);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* See nsIDOMEventListener
|
||||
*/
|
||||
handleEvent: function(aEvent) {
|
||||
if (aEvent.type == "unload") {
|
||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch2);
|
||||
prefBranch.removeObserver(PREF_SELECTED_WEB, this);
|
||||
window.removeEventListener("unload", this, false);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes this.
|
||||
*/
|
||||
init: function () {
|
||||
var _delayedPaneLoad = function(self) {
|
||||
self._initFeedReaders();
|
||||
self.updateSelectedReader();
|
||||
}
|
||||
setTimeout(_delayedPaneLoad, 0, this);
|
||||
|
||||
// For web readers, we need to call setAutoHandler if the
|
||||
// preview page should be skipped (i.e. PREF_SELECTED_ACTION="reader")
|
||||
// To do so, we've to add a pref-observer in order to be notified on
|
||||
// actual pref-changes (i.e. not on pref changes which may not take
|
||||
// affect when the prefwindow is closed)
|
||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch2);
|
||||
|
||||
prefBranch.addObserver(PREF_SELECTED_WEB, this, false);
|
||||
window.addEventListener("unload", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Populates the UI list of available feed readers.
|
||||
*/
|
||||
_initFeedReaders: function() {
|
||||
this.updateSelectedApplicationInfo();
|
||||
|
||||
var readersList = this.element("readers");
|
||||
|
||||
// List the system default feed reader if it is
|
||||
// not the last-selected application already
|
||||
try {
|
||||
var systemDefaultReader = Cc["@mozilla.org/browser/shell-service;1"].
|
||||
getService(Ci.nsIShellService).
|
||||
defaultFeedReader;
|
||||
|
||||
var defaultSystemReaderFilefield = this.element("defaultSystemReaderFilefield");
|
||||
defaultSystemReaderFilefield.file = systemDefaultReader;
|
||||
var selectedAppFile = this.element("selectedAppFilefield").file;
|
||||
if (!selectedAppFile || defaultSystemReaderFilefield.file.path !=
|
||||
selectedAppFile.path) {
|
||||
var defaultReaderItem = document.createElementNS(kXULNS, "listitem");
|
||||
defaultReaderItem.id = "defaultSystemReaderListitem";
|
||||
defaultReaderItem.className = "listitem-iconic";
|
||||
defaultReaderItem.setAttribute("label", defaultSystemReaderFilefield.label);
|
||||
defaultReaderItem.setAttribute("image", defaultSystemReaderFilefield.image);
|
||||
readersList.appendChild(defaultReaderItem);
|
||||
}
|
||||
}
|
||||
catch(ex) { /* no default reader */ }
|
||||
|
||||
// List of web handlers
|
||||
var wccr =
|
||||
Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
|
||||
getService(Ci.nsIWebContentConverterService);
|
||||
var handlers = wccr.getContentHandlers(TYPE_MAYBE_FEED, {});
|
||||
if (handlers.length == 0)
|
||||
return;
|
||||
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
for (var i = 0; i < handlers.length; ++i) {
|
||||
var row = document.createElementNS(kXULNS, "listitem");
|
||||
row.className = "listitem-iconic";
|
||||
row.setAttribute("label", handlers[i].name);
|
||||
row.setAttribute("webhandlerurl", handlers[i].uri);
|
||||
|
||||
var uri = ios.newURI(handlers[i].uri, null, null);
|
||||
if (/^https?/.test(uri.scheme))
|
||||
row.setAttribute("image", uri.prePath + "/favicon.ico");
|
||||
|
||||
readersList.appendChild(row);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the label and image of the client feed reader listitem
|
||||
*/
|
||||
updateSelectedApplicationInfo: function() {
|
||||
var appItemCell = this.element("selectedApplicationCell");
|
||||
var selectedAppFilefield = this.element("selectedAppFilefield");
|
||||
selectedAppFilefield.file = this.element(PREF_SELECTED_APP).value;
|
||||
if (selectedAppFilefield.file) {
|
||||
appItemCell.setAttribute("label", selectedAppFilefield.label);
|
||||
appItemCell.setAttribute("image", selectedAppFilefield.image);
|
||||
}
|
||||
else {
|
||||
var noAppString =
|
||||
this.element("stringbundle").getString("noApplicationSelected");
|
||||
appItemCell.setAttribute("label", noAppString);
|
||||
appItemCell.setAttribute("image", "");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects a item in the list without triggering a preference change.
|
||||
*
|
||||
* @param aItem
|
||||
* the listitem to be selected
|
||||
*/
|
||||
_silentSelectReader: function(aItem) {
|
||||
var readers = this.element("readers");
|
||||
readers.setAttribute("suppressonselect", "true");
|
||||
readers.selectItem(aItem);
|
||||
readers.removeAttribute("suppressonselect");
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper for updateSelectedReader. Syncs the selected item in the readers
|
||||
* list with value stored invalues stored in PREF_SELECTED_WEB
|
||||
*/
|
||||
_updateSelectedWebHandlerItem: function() {
|
||||
// We should select the new web handler only if the default handler
|
||||
// is "web"
|
||||
var readers = this.element("readers")
|
||||
var readerElts =
|
||||
readers.getElementsByAttribute("webhandlerurl",
|
||||
this.element(PREF_SELECTED_WEB).value);
|
||||
|
||||
// XXXmano: handle the addition of a new web handler
|
||||
if (readerElts.length > 0)
|
||||
this._silentSelectReader(readerElts[0]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Syncs the selected item in the readers list with the values stored in
|
||||
* preferences.
|
||||
*/
|
||||
updateSelectedReader: function() {
|
||||
var defaultReader = this.element(PREF_SELECTED_READER).value ||
|
||||
"bookmarks";
|
||||
switch (defaultReader) {
|
||||
case "bookmarks":
|
||||
this._silentSelectReader(this.element("liveBookmarksListItem"));
|
||||
break;
|
||||
case "client":
|
||||
#ifdef XP_WIN
|
||||
// Keep the system default feed reader item selected if the
|
||||
// last-selected application is the the system default feed reader
|
||||
// and if it is already selected
|
||||
var currentItem = this.element("readers").currentItem;
|
||||
if (currentItem && currentItem.id == "defaultSystemReaderListitem") {
|
||||
var defaultSystemReaderFile = this.element("defaultSystemReaderFilefield").file;
|
||||
var selectedAppFile = this.element("selectedAppFilefield").file;
|
||||
if (selectedAppFile && defaultSystemReaderFile &&
|
||||
defaultSystemReaderFile.path == selectedAppFile.path)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
this._silentSelectReader(this.element("selectedApplicationListitem"));
|
||||
break;
|
||||
case "web":
|
||||
this._updateSelectedWebHandlerItem();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a prompt from which the user may choose an a (client) feed reader.
|
||||
*/
|
||||
chooseClientApp: function () {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"]
|
||||
.createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, document.title, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file) {
|
||||
// XXXben - we need to compare this with the running instance executable
|
||||
// just don't know how to do that via script...
|
||||
// XXXmano TBD: can probably add this to nsIShellService
|
||||
#ifdef XP_WIN
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_NAME__.exe")
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_DISPLAYNAME__.app")
|
||||
#else
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_NAME__-bin")
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
|
||||
this.element(PREF_SELECTED_APP).value = fp.file;
|
||||
this.element(PREF_SELECTED_READER).value = "client";
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables the readers list if "Show preview..." is selected, enables
|
||||
* it otherwise.
|
||||
*/
|
||||
onReadingMethodSelect: function() {
|
||||
var disableList = this.element("readingMethod").value == "ask";
|
||||
this.element("readers").disabled = disableList;
|
||||
this.element("chooseClientApp").disabled = disableList;
|
||||
},
|
||||
|
||||
/**
|
||||
* Maps the value of PREF_SELECTED_ACTION to the parallel
|
||||
* value in the radiogroup
|
||||
*/
|
||||
onReadingMethodSyncFromPreference: function() {
|
||||
var pref = this.element(PREF_SELECTED_ACTION);
|
||||
var newVal = pref.instantApply ? pref.valueFromPreferences : pref.value;
|
||||
if (newVal != "ask")
|
||||
return "reader";
|
||||
|
||||
return "ask";
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the value to be used for PREF_SELECTED_ACTION
|
||||
* according to the current UI state.
|
||||
*/
|
||||
onReadingMethodSyncToPreference: function() {
|
||||
var readers = this.element("readers");
|
||||
|
||||
// A reader must be choosed in order to skip the preview page
|
||||
if (this.element("readingMethod").value == "ask" ||
|
||||
!readers.currentItem)
|
||||
return "ask";
|
||||
|
||||
if (readers.currentItem.id == "liveBookmarksListItem")
|
||||
return "bookmarks";
|
||||
|
||||
return "reader";
|
||||
},
|
||||
|
||||
/**
|
||||
* Syncs PREF_SELECTED_READER with the selected item in the readers list
|
||||
* Also updates PREF_SELECTED_ACTION if necessary
|
||||
*/
|
||||
writeSelectedFeedReader: function() {
|
||||
// Force update of the action pref. This is needed for the case in which
|
||||
// the user flipped from a reader to live bookmarks or vice-versa
|
||||
this.element(PREF_SELECTED_ACTION).value =
|
||||
this.onReadingMethodSyncToPreference();
|
||||
|
||||
var currentItem = this.element("readers").currentItem;
|
||||
if (currentItem.hasAttribute("webhandlerurl")) {
|
||||
this.element(PREF_SELECTED_WEB).value =
|
||||
currentItem.getAttribute("webhandlerurl");
|
||||
this.element(PREF_SELECTED_READER).value = "web";
|
||||
}
|
||||
else {
|
||||
switch (currentItem.id) {
|
||||
case "liveBookmarksListItem":
|
||||
this.element(PREF_SELECTED_READER).value = "bookmarks";
|
||||
break;
|
||||
case "selectedApplicationListitem":
|
||||
// PREF_SELECTED_APP is saved in chooseClientApp
|
||||
this.element(PREF_SELECTED_READER).value = "client";
|
||||
break;
|
||||
#ifdef XP_WIN
|
||||
case "defaultSystemReaderListitem":
|
||||
this.element(PREF_SELECTED_APP).value = this.element("defaultSystemReaderFilefield").file;
|
||||
this.element(PREF_SELECTED_READER).value = "client";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,121 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Firefox Preferences System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Jeff Walden <jwalden+code@mit.edu>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Asaf Romano <mozilla.mano@sent.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % feedsDTD SYSTEM "chrome://browser/locale/preferences/feeds.dtd">
|
||||
%feedsDTD;
|
||||
]>
|
||||
|
||||
<overlay id="FeedsPaneOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:aaa="http://www.w3.org/2005/07/aaa">
|
||||
|
||||
<prefpane id="paneFeeds"
|
||||
onpaneload="gFeedsPane.init();"
|
||||
helpTopic="prefs-feeds"
|
||||
helpURI="chrome://browser/locale/help/help.rdf">
|
||||
|
||||
<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"
|
||||
onchange="gFeedsPane.updateSelectedReader();"
|
||||
type="string"/>
|
||||
<preference id="browser.feeds.handlers.application"
|
||||
name="browser.feeds.handlers.application"
|
||||
onchange="gFeedsPane.updateSelectedApplicationInfo();"
|
||||
type="file"/>
|
||||
<preference id="browser.feeds.handlers.webservice"
|
||||
name="browser.feeds.handlers.webservice"
|
||||
onchange="gFeedsPane.updateSelectedReader();"
|
||||
type="string"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/preferences/feeds.js"/>
|
||||
|
||||
<filefield class="indent" id="selectedAppFilefield" disabled="true" hidden="true"/>
|
||||
#ifdef XP_WIN
|
||||
<filefield class="indent" id="defaultSystemReaderFilefield" disabled="true" hidden="true"/>
|
||||
#endif
|
||||
|
||||
<stringbundle id="stringbundle" src="chrome://browser/locale/preferences/feeds.properties"/>
|
||||
|
||||
<label value="&feedClick.label;"/>
|
||||
<radiogroup id="readingMethod"
|
||||
class="indent"
|
||||
preference="browser.feeds.handler"
|
||||
onsyncfrompreference="return gFeedsPane.onReadingMethodSyncFromPreference();"
|
||||
onsynctopreference="return gFeedsPane.onReadingMethodSyncToPreference();"
|
||||
onselect="gFeedsPane.onReadingMethodSelect();">
|
||||
<radio value="ask"
|
||||
label="&showPreview.label;"
|
||||
accesskey="&showPreview.accesskey;"/>
|
||||
<radio value="reader" id="useReader"
|
||||
label="&subscribeUsing.label;"
|
||||
accesskey="&subscribeUsing.accesskey;"
|
||||
aaa:labelledby="useReader readers"/>
|
||||
<hbox id="readerContainer" class="indent" flex="1">
|
||||
<listbox id="readers" rows="5" flex="1"
|
||||
aaa:labelledby="useReader"
|
||||
onselect="gFeedsPane.writeSelectedFeedReader(); event.stopPropagation();">
|
||||
<listcols>
|
||||
<listcol flex="1"/>
|
||||
<listcol/>
|
||||
</listcols>
|
||||
<listitem id="liveBookmarksListItem"
|
||||
label="&liveBookmarks.label;"
|
||||
class="listitem-iconic"
|
||||
image="chrome://browser/skin/page-livemarks.png"/>
|
||||
<listitem id="selectedApplicationListitem" allowevents="true">
|
||||
<listcell id="selectedApplicationCell" class="listcell-iconic"/>
|
||||
<listcell id="chooseClientAppCell">
|
||||
<button id="chooseClientApp"
|
||||
label="&chooseApplication.label;"
|
||||
accesskey="&chooseApplication.accesskey;"
|
||||
oncommand="gFeedsPane.chooseClientApp();"/>
|
||||
</listcell>
|
||||
</listitem>
|
||||
</listbox>
|
||||
</hbox>
|
||||
</radiogroup>
|
||||
</prefpane>
|
||||
</overlay>
|
|
@ -0,0 +1,66 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Myk Melez <myk@mozilla.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
richlistitem {
|
||||
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler");
|
||||
}
|
||||
|
||||
richlistitem[selected="true"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler-selected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Somewhat line up the actions menu with action labels above and below it.
|
||||
* FIXME: to really line this up, equalize the distance from the left side
|
||||
* of the action box to the left side of the icon for both the menu and the
|
||||
* non-menu versions of the action box. Also make sure the labels are the
|
||||
* same distance away from the icons.
|
||||
*/
|
||||
.actionsMenu {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the icons appear and pad them a bit.
|
||||
* Note: we display the icon box for every item whether or not it has an icon
|
||||
* so the labels of all the items align vertically.
|
||||
*/
|
||||
.actionsMenu > menupopup > menuitem > .menu-iconic-left {
|
||||
display: -moz-box;
|
||||
min-width: 16px;
|
||||
-moz-padding-start: 2px;
|
||||
-moz-padding-end: 2px;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is the Mozilla browser.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Mozilla.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2007
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Myk Melez <myk@mozilla.org>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
|
||||
%brandDTD;
|
||||
%applicationsDTD;
|
||||
]>
|
||||
|
||||
<bindings id="handlerBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="handler-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
|
||||
<implementation>
|
||||
<property name="type" readonly="true">
|
||||
<getter>
|
||||
return this.getAttribute("type");
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="handler" extends="chrome://browser/content/preferences/handlers.xml#handler-base">
|
||||
<content>
|
||||
<xul:hbox flex="1" equalsize="always">
|
||||
<xul:hbox flex="1" align="center">
|
||||
<xul:image xbl:inherits="src=typeIcon" height="16" width="16"/>
|
||||
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox flex="1" align="center">
|
||||
<xul:image xbl:inherits="src=actionIcon" height="16" width="16"/>
|
||||
<xul:label flex="1" crop="end" xbl:inherits="value=actionDescription"/>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="handler-selected" extends="chrome://browser/content/preferences/handlers.xml#handler-base">
|
||||
<content>
|
||||
<xul:hbox flex="1" equalsize="always">
|
||||
<xul:hbox flex="1" align="center">
|
||||
<xul:image xbl:inherits="src=typeIcon" height="16" width="16"/>
|
||||
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox flex="1">
|
||||
<xul:menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1"
|
||||
oncommand="gApplicationsPane.onSelectAction(event)">
|
||||
<xul:menupopup/>
|
||||
</xul:menulist>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
gApplicationsPane.rebuildActionsMenu();
|
||||
</constructor>
|
||||
</implementation>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -2,8 +2,8 @@ browser.jar:
|
|||
* content/browser/preferences/advanced.xul
|
||||
* content/browser/preferences/advanced.js
|
||||
* content/browser/preferences/advanced-scripts.xul
|
||||
* content/browser/preferences/changeaction.xul
|
||||
* content/browser/preferences/changeaction.js
|
||||
* content/browser/preferences/applications.xul
|
||||
* content/browser/preferences/applications.js
|
||||
* content/browser/preferences/colors.xul
|
||||
* content/browser/preferences/cookies.xul
|
||||
* content/browser/preferences/cookies.js
|
||||
|
@ -11,13 +11,11 @@ browser.jar:
|
|||
* content/browser/preferences/content.js
|
||||
* content/browser/preferences/connection.xul
|
||||
* content/browser/preferences/connection.js
|
||||
* content/browser/preferences/downloadactions.xul
|
||||
* content/browser/preferences/downloadactions.js
|
||||
* content/browser/preferences/fallbackEULA.xhtml
|
||||
* content/browser/preferences/feeds.xul
|
||||
* content/browser/preferences/feeds.js
|
||||
* content/browser/preferences/fonts.xul
|
||||
* content/browser/preferences/fonts.js
|
||||
* content/browser/preferences/handlers.xml
|
||||
* content/browser/preferences/handlers.css
|
||||
* content/browser/preferences/languages.xul
|
||||
* content/browser/preferences/languages.js
|
||||
* content/browser/preferences/main.xul
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
|
||||
<!-- XXX This should be in applications.xul, but bug 393953 means putting it
|
||||
- there causes the Applications pane not to work the first time you open
|
||||
- the Preferences dialog in a browsing session, so we work around the problem
|
||||
- by putting it here instead.
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://browser/content/preferences/handlers.css"?>
|
||||
|
||||
<!DOCTYPE prefwindow [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://browser/locale/preferences/preferences.dtd">
|
||||
|
@ -93,8 +100,8 @@
|
|||
src="chrome://browser/content/preferences/tabs.xul"/>
|
||||
<prefpane id="paneContent" label="&paneContent.title;"
|
||||
src="chrome://browser/content/preferences/content.xul"/>
|
||||
<prefpane id="paneFeeds" label="&paneFeeds.title;"
|
||||
src="chrome://browser/content/preferences/feeds.xul"/>
|
||||
<prefpane id="paneApplications" label="&paneApplications.title;"
|
||||
src="chrome://browser/content/preferences/applications.xul"/>
|
||||
<prefpane id="panePrivacy" label="&panePrivacy.title;"
|
||||
src="chrome://browser/content/preferences/privacy.xul"/>
|
||||
<prefpane id="paneSecurity" label="&paneSecurity.title;"
|
||||
|
|
|
@ -208,7 +208,6 @@ PROT_PhishMsgDisplayerBase.prototype.browserSelected = function() {
|
|||
this.messageShouldShow_ = true;
|
||||
}
|
||||
|
||||
this.hideLockIcon_(); // Comes back when we are unselected or unloaded
|
||||
this.addWarningInUrlbar_(); // Goes away when we are unselected or unloaded
|
||||
|
||||
// messageShouldShow might be false if the user dismissed the warning,
|
||||
|
@ -234,7 +233,6 @@ PROT_PhishMsgDisplayerBase.prototype.explicitShow = function() {
|
|||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.browserUnselected = function() {
|
||||
this.removeWarningInUrlbar_();
|
||||
this.unhideLockIcon_();
|
||||
if (this.messageShowing_)
|
||||
this.hideMessage_();
|
||||
}
|
||||
|
@ -290,7 +288,6 @@ PROT_PhishMsgDisplayerBase.prototype.done = function() {
|
|||
// If we were started, we must be the current problem, so these things
|
||||
// must be showing
|
||||
this.removeWarningInUrlbar_();
|
||||
this.unhideLockIcon_();
|
||||
|
||||
// Could be though that they've closed the warning dialog
|
||||
if (this.messageShowing_)
|
||||
|
@ -327,28 +324,6 @@ PROT_PhishMsgDisplayerBase.prototype.removeIfExists_ = function(orig,
|
|||
return orig;
|
||||
}
|
||||
|
||||
/**
|
||||
* We don't want to confuse users if they land on a phishy page that uses
|
||||
* SSL, so ensure that the lock icon never shows when we're showing our
|
||||
* warning.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.hideLockIcon_ = function() {
|
||||
var lockIcon = this.doc_.getElementById("lock-icon");
|
||||
if (!lockIcon)
|
||||
return;
|
||||
lockIcon.hidden = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure they can see it after our warning is finished.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.unhideLockIcon_ = function() {
|
||||
var lockIcon = this.doc_.getElementById("lock-icon");
|
||||
if (!lockIcon)
|
||||
return;
|
||||
lockIcon.hidden = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method makes our warning icon visible in the location bar. It will
|
||||
* be removed only when the problematic document is navigated awy from
|
||||
|
|
|
@ -205,6 +205,7 @@ const SEARCH_LOG_PREFIX = "*** Search: ";
|
|||
* logging pref (browser.search.log) is set to true.
|
||||
*/
|
||||
function LOG(aText) {
|
||||
#ifdef DEBUG
|
||||
var prefB = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
var shouldLog = false;
|
||||
|
@ -218,6 +219,7 @@ function LOG(aText) {
|
|||
getService(Ci.nsIConsoleService);
|
||||
consoleService.logStringMessage(aText);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
function ERROR(message, resultCode) {
|
||||
|
|
|
@ -174,7 +174,6 @@ bin/components/websrvcs.xpt
|
|||
bin/components/widget.xpt
|
||||
bin/components/windowds.xpt
|
||||
bin/components/windowwatcher.xpt
|
||||
bin/components/xml-rpc.xpt
|
||||
bin/components/xpcom_base.xpt
|
||||
bin/components/xpcom_system.xpt
|
||||
bin/components/xpcom_components.xpt
|
||||
|
@ -218,7 +217,6 @@ bin/components/nsProxyAutoConfig.js
|
|||
; bin/components/nsResetPref.js not needed for firefox
|
||||
bin/components/nsSidebar.js
|
||||
; bin/components/nsUpdateNotifier.js not needed for firefox
|
||||
bin/components/nsXmlRpcClient.js
|
||||
bin/components/nsExtensionManager.js
|
||||
bin/components/nsBlocklistService.js
|
||||
bin/components/nsUpdateService.js
|
||||
|
|
|
@ -180,7 +180,6 @@ bin\components\widget.xpt
|
|||
bin\components\windowds.xpt
|
||||
bin\components\windowwatcher.xpt
|
||||
bin\components\shellservice.xpt
|
||||
bin\components\xml-rpc.xpt
|
||||
bin\components\xpcom_base.xpt
|
||||
bin\components\xpcom_system.xpt
|
||||
bin\components\xpcom_components.xpt
|
||||
|
@ -210,7 +209,6 @@ bin\components\nsProxyAutoConfig.js
|
|||
bin\components\nsSearchService.js
|
||||
bin\components\nsSearchSuggestions.js
|
||||
bin\components\nsSidebar.js
|
||||
bin\components\nsXmlRpcClient.js
|
||||
bin\components\nsExtensionManager.js
|
||||
bin\components\nsBlocklistService.js
|
||||
bin\components\nsUpdateService.js
|
||||
|
|
|
@ -350,3 +350,5 @@
|
|||
|
||||
<!ENTITY editBookmark.done.label "Done">
|
||||
<!ENTITY editBookmark.delete.label "Delete">
|
||||
|
||||
<!ENTITY identity.moreInfoLinkText "Tell me more about this web site...">
|
||||
|
|
|
@ -97,3 +97,20 @@ chromelessWindow.warningMessage=The web site at %S has hidden your toolbars.
|
|||
chromelessWindow.warningNoLocation=This web site has hidden your toolbars.
|
||||
chromelessWindow.showToolbarsButton=Show Toolbars
|
||||
chromelessWindow.accessKey=S
|
||||
|
||||
# Identity information
|
||||
identity.domainverified.title=Location Verified
|
||||
identity.domainverified.body=You are currently visiting:
|
||||
identity.domainverified.supplemental=Information identifying the owner of this site may not have been validated.
|
||||
|
||||
identity.identified.title=Identity Verified
|
||||
identity.identified.body=This website is owned by:
|
||||
identity.identified.verifier=Verified by: %S
|
||||
identity.identified.state_and_country=%S, %S
|
||||
identity.identified.title_with_country=%S (%S)
|
||||
|
||||
identity.unknown.title=Identity Unknown
|
||||
identity.unknown.body=This web site does not supply identity information.
|
||||
|
||||
identity.encrypted=Your connection to this web site is encrypted to prevent eavesdropping.
|
||||
identity.unencrypted=Your connection to this web site is not encrypted.
|
||||
|
|
|
@ -67,6 +67,18 @@
|
|||
"Import...">
|
||||
<!ENTITY cmd.import.accesskey
|
||||
"I">
|
||||
<!ENTITY cmd.backup.label
|
||||
"Backup...">
|
||||
<!ENTITY cmd.backup.accesskey
|
||||
"B">
|
||||
<!ENTITY cmd.restore.label
|
||||
"Restore...">
|
||||
<!ENTITY cmd.restore.accesskey
|
||||
"R">
|
||||
<!ENTITY cmd.restoreFromFile.label
|
||||
"Choose File...">
|
||||
<!ENTITY cmd.restoreFromFile.accesskey
|
||||
"C">
|
||||
<!ENTITY cmd.select_all.label
|
||||
"Select All">
|
||||
<!ENTITY cmd.select_all.accesskey
|
||||
|
|
|
@ -20,6 +20,13 @@ bookmarksMenuEmptyFolder=(Empty)
|
|||
bookmarksLivemarkLoading=Live Bookmark loading...
|
||||
bookmarksLivemarkFailed=Live Bookmark feed failed to load.
|
||||
|
||||
bookmarksBackupFilename=Bookmarks %1$S.html
|
||||
bookmarksBackupTitle=Bookmarks backup filename
|
||||
|
||||
bookmarksRestoreAlertTitle=Revert Bookmarks
|
||||
bookmarksRestoreAlert=This will replace all of your current bookmarks with the backup. Are you sure?
|
||||
bookmarksRestoreTitle=Select a bookmarks backup
|
||||
|
||||
headerTextPrefix1=Showing
|
||||
headerTextPrefix2=Search Results for
|
||||
headerTextPrefix3=Advanced Search
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!ENTITY prefpane.label "Here you can configure &brandShortName; to let your favorite applications handle different types of content.">
|
||||
<!ENTITY filterActive.label "The following entries match your search:">
|
||||
|
||||
<!ENTITY typeColumn.label "Content Type">
|
||||
<!ENTITY typeColumn.accesskey "T">
|
||||
|
||||
<!ENTITY actionColumn.label "Application">
|
||||
<!ENTITY actionColumn.accesskey "A">
|
||||
|
||||
<!ENTITY focusSearch1.key "f">
|
||||
<!ENTITY focusSearch2.key "k">
|
||||
|
||||
<!ENTITY filter.label "Search:">
|
||||
<!ENTITY filter.accesskey "S">
|
||||
|
||||
<!ENTITY clear.label "Clear">
|
||||
<!ENTITY clear.accesskey "l">
|
|
@ -1,23 +0,0 @@
|
|||
<!ENTITY changeAction.title "Change Action">
|
||||
<!ENTITY window.width "36em">
|
||||
|
||||
<!ENTITY whenDownloading.label "When downloading files like this:">
|
||||
|
||||
<!ENTITY openDefault.label "Open them with the default application:">
|
||||
<!ENTITY openDefault.accesskey "O">
|
||||
<!ENTITY openApplication.label "Open them with this application:">
|
||||
<!ENTITY openApplication.accesskey "e">
|
||||
<!ENTITY changeApp.label "Browse...">
|
||||
<!ENTITY changeApp.accesskey "B">
|
||||
<!ENTITY saveToDisk.label "Save them on my computer">
|
||||
<!ENTITY saveToDisk.accesskey "S">
|
||||
<!ENTITY saveToDefaultFolder.label "in the default download folder">
|
||||
<!ENTITY saveToDefaultFolder.accesskey "d">
|
||||
<!ENTITY saveToThisFolder.label "in this folder:">
|
||||
<!ENTITY saveToThisFolder.accesskey "h">
|
||||
<!ENTITY chooseFolder.label "Browse...">
|
||||
<!ENTITY chooseFolder.accesskey "w">
|
||||
<!ENTITY saveToAskMe.label "ask me where to save the file">
|
||||
<!ENTITY saveToAskMe.accesskey "a">
|
||||
<!ENTITY usePlugin.label "Use this Plugin:">
|
||||
<!ENTITY usePlugin.accesskey "P">
|
|
@ -11,7 +11,7 @@
|
|||
<!ENTITY manualTypeRadio.label "Manual proxy configuration:">
|
||||
<!ENTITY manualTypeRadio.accesskey "m">
|
||||
<!ENTITY autoTypeRadio.label "Automatic proxy configuration URL:">
|
||||
<!ENTITY autoTypeRadio.accesskey "a">
|
||||
<!ENTITY autoTypeRadio.accesskey "A">
|
||||
<!ENTITY reload.label "Reload">
|
||||
<!ENTITY reload.accesskey "e">
|
||||
<!ENTITY ftp.label "FTP Proxy:">
|
||||
|
|
|
@ -29,9 +29,3 @@
|
|||
|
||||
<!ENTITY colors.label "Colors...">
|
||||
<!ENTITY colors.accesskey "C">
|
||||
|
||||
<!ENTITY fileTypes.label "File Types">
|
||||
|
||||
<!ENTITY configureFileTypes.label "Configure how &brandShortName; handles certain types of files">
|
||||
<!ENTITY manage.label "Manage...">
|
||||
<!ENTITY manage.accesskey "M">
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<!ENTITY downloadactionsWindow.title "Download Actions">
|
||||
<!ENTITY window.width "480">
|
||||
<!ENTITY window.height "310">
|
||||
|
||||
<!ENTITY fileTypesDescription.label "Automatically perform the associated Action with each of the following file types:">
|
||||
|
||||
<!ENTITY fileHandlerColumn.label "Action">
|
||||
<!ENTITY fileHandlerColumn.accesskey "A">
|
||||
<!ENTITY fileTypeColumn.label "File Type">
|
||||
<!ENTITY fileTypeColumn.accesskey "T">
|
||||
<!ENTITY fileMIMETypeColumn.label "MIME Type">
|
||||
<!ENTITY fileMIMETypeColumn.accesskey "M">
|
||||
<!ENTITY fileExtensionColumn.label "Extension">
|
||||
<!ENTITY fileExtensionColumn.accesskey "E">
|
||||
|
||||
<!ENTITY remove.label "Remove Action">
|
||||
<!ENTITY remove.accesskey "R">
|
||||
<!ENTITY edit.label "Change Action...">
|
||||
<!ENTITY edit.accesskey "C">
|
||||
|
||||
<!ENTITY windowClose.key "w">
|
||||
<!ENTITY focusSearch1.key "f">
|
||||
<!ENTITY focusSearch2.key "k">
|
||||
|
||||
<!ENTITY filter.label "Search:">
|
||||
<!ENTITY filter.accesskey "S">
|
||||
<!ENTITY clear.label "Clear">
|
||||
<!ENTITY clear.accesskey "l">
|
||||
|
||||
<!ENTITY button.close.label "Close">
|
||||
<!ENTITY button.close.accesskey "o">
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!ENTITY feedClick.label "When I click on a web feed:">
|
||||
<!ENTITY showPreview.label "Show me a preview and ask me which Feed Reader to use">
|
||||
<!ENTITY showPreview.accesskey "S">
|
||||
<!ENTITY subscribeUsing.label "Subscribe to the feed using:">
|
||||
<!ENTITY subscribeUsing.accesskey "u">
|
||||
<!ENTITY liveBookmarks.label "Live Bookmarks">
|
||||
<!ENTITY chooseApplication.label "Choose Application...">
|
||||
<!ENTITY chooseApplication.accesskey "C">
|
|
@ -1 +0,0 @@
|
|||
noApplicationSelected=No Application Selected
|
|
@ -10,7 +10,7 @@
|
|||
<!ENTITY paneMain.title "Main">
|
||||
<!ENTITY paneTabs.title "Tabs">
|
||||
<!ENTITY paneContent.title "Content">
|
||||
<!ENTITY paneFeeds.title "Feeds">
|
||||
<!ENTITY paneApplications.title "Applications">
|
||||
<!ENTITY panePrivacy.title "Privacy">
|
||||
<!ENTITY paneSecurity.title "Security">
|
||||
<!ENTITY paneAdvanced.title "Advanced">
|
||||
|
|
|
@ -43,29 +43,19 @@ desktopFolderName=Desktop
|
|||
downloadsFolderName=Downloads
|
||||
chooseDownloadFolderTitle=Choose Download Folder:
|
||||
|
||||
#### Download Actions
|
||||
#### Applications
|
||||
|
||||
extensionNone=(NONE)
|
||||
removeButtonSingle=Remove Action
|
||||
removeButtonMultiple=Remove Actions
|
||||
removeTitleSingle=Remove Action
|
||||
removeTitleMultiple=Remove Actions
|
||||
removeMessageSingle=The selected Action will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove this Action?
|
||||
removeMessageMultiple=The selected Actions will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove these Actions?
|
||||
removeType=Remove this entry...
|
||||
removeButton=Remove Entry
|
||||
removeTitle=Remove Entry
|
||||
removeMessage=If you remove this entry, Firefox will ask you what to do next time you access content of this type. Are you sure you want to remove this entry?
|
||||
fileEnding=%S file
|
||||
saveToDisk=Save to Disk
|
||||
openWith=Open with %S
|
||||
actionsFiltered=The following Actions match your search:
|
||||
actionsAll=Automatically perform the associated Action with each of the following file types:
|
||||
|
||||
|
||||
#### Change Action
|
||||
|
||||
extensionStringFormat=%S, %S
|
||||
downloadHelperNoneSelected=None Selected
|
||||
pluginHelperNoneAvailable=None Available
|
||||
chooseApp=Choose application...
|
||||
fpTitleChooseApp=Select Helper Application
|
||||
fpTitleChooseDL=Select Download Folder
|
||||
webFeed=Web Feed
|
||||
alwaysAskAboutFeed=Show me a preview and ask me which Feed Reader to use
|
||||
liveBookmarks=Live Bookmarks
|
||||
|
||||
#### Cookie Viewer
|
||||
|
||||
|
|
|
@ -45,15 +45,12 @@
|
|||
locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties)
|
||||
locale/browser/preferences/advanced.dtd (%chrome/browser/preferences/advanced.dtd)
|
||||
* locale/browser/preferences/advanced-scripts.dtd (%chrome/browser/preferences/advanced-scripts.dtd)
|
||||
locale/browser/preferences/changeaction.dtd (%chrome/browser/preferences/changeaction.dtd)
|
||||
locale/browser/preferences/colors.dtd (%chrome/browser/preferences/colors.dtd)
|
||||
locale/browser/preferences/cookies.dtd (%chrome/browser/preferences/cookies.dtd)
|
||||
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
|
||||
locale/browser/preferences/connection.dtd (%chrome/browser/preferences/connection.dtd)
|
||||
locale/browser/preferences/downloadactions.dtd (%chrome/browser/preferences/downloadactions.dtd)
|
||||
locale/browser/preferences/applications.dtd (%chrome/browser/preferences/applications.dtd)
|
||||
locale/browser/preferences/fallbackEULA.dtd (%chrome/browser/preferences/fallbackEULA.dtd)
|
||||
locale/browser/preferences/feeds.dtd (%chrome/browser/preferences/feeds.dtd)
|
||||
locale/browser/preferences/feeds.properties (%chrome/browser/preferences/feeds.properties)
|
||||
locale/browser/preferences/fonts.dtd (%chrome/browser/preferences/fonts.dtd)
|
||||
locale/browser/preferences/main.dtd (%chrome/browser/preferences/main.dtd)
|
||||
locale/browser/preferences/languages.dtd (%chrome/browser/preferences/languages.dtd)
|
||||
|
|
|
@ -827,7 +827,7 @@ toolbar[iconsize="small"] #paste-button:hover:active {
|
|||
#urlbar {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
-moz-margin-start: 4px;
|
||||
-moz-margin-start: 0px;
|
||||
-moz-margin-end: 0px;
|
||||
width: 7em;
|
||||
min-width: 7em;
|
||||
|
@ -879,46 +879,6 @@ toolbar[iconsize="small"] #paste-button:hover:active {
|
|||
background: url("chrome://browser/skin/Secure-background.gif") #FFFED8 repeat-x;
|
||||
}
|
||||
|
||||
#urlbar #lock-icon {
|
||||
height: 18px;
|
||||
margin: -1px;
|
||||
}
|
||||
|
||||
#urlbar[level="high"] #lock-icon {
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
}
|
||||
#urlbar[level="high"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
}
|
||||
#urlbar[level="high"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
}
|
||||
|
||||
#urlbar[level="low"] #lock-icon {
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
}
|
||||
#urlbar[level="low"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
}
|
||||
#urlbar[level="low"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
}
|
||||
|
||||
#urlbar[level="broken"] #lock-icon {
|
||||
list-style-image: url("chrome://browser/skin/Security-broken.png");
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
}
|
||||
|
||||
#urlbar[level="broken"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
}
|
||||
|
||||
#urlbar[level="broken"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
}
|
||||
|
||||
#urlbar-container {
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
@ -979,13 +939,6 @@ statusbarpanel#statusbar-display {
|
|||
|
||||
#treecolAutoCompleteImage {
|
||||
max-width : 36px;
|
||||
padding-end: 18px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(favicon, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/starPage.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
|
||||
|
@ -994,6 +947,12 @@ statusbarpanel#statusbar-display {
|
|||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(tag, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/tag.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
color: #555566;
|
||||
}
|
||||
|
@ -1703,3 +1662,116 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
|||
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight !important;
|
||||
}
|
||||
|
||||
/* ::::: Identity Indicator Styling ::::: */
|
||||
/* Location bar visuals*/
|
||||
#identity-box {
|
||||
/* Extend our margins out so that our highlight/separator bar covers the
|
||||
location bar properly */
|
||||
margin: -1px 0 -2px;
|
||||
padding: 1px 2px 2px 0;
|
||||
border-right: 1px solid #888;
|
||||
background-color: white;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
#identity-box:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity {
|
||||
background-color: #BFA;
|
||||
}
|
||||
|
||||
#urlbar[level="high"] > #identity-box,
|
||||
#urlbar[level="low"] > #identity-box {
|
||||
/* urlbar adds padding when security level is set, which we need to
|
||||
counteract here so that we still fill the background. */
|
||||
margin: -2px;
|
||||
padding: 1px 2px;
|
||||
}
|
||||
|
||||
#identity-icon-label {
|
||||
padding: 1px 2px 2px;
|
||||
margin: 0;
|
||||
color: black;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.unknownIdentity > #identity-icon-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Popup Icons */
|
||||
#identity-popup-icon {
|
||||
height: 64px;
|
||||
width: 64px;
|
||||
padding: 0;
|
||||
margin: 10px 0 0;
|
||||
list-style-image: url("chrome://browser/skin/identity.png");
|
||||
-moz-image-region: rect(0px, 64px, 64px, 0px);
|
||||
}
|
||||
|
||||
.verifiedDomain > #identity-popup-container > #identity-popup-icon {
|
||||
-moz-image-region: rect(64px, 64px, 128px, 0px);
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-container > #identity-popup-icon {
|
||||
-moz-image-region: rect(128px, 64px, 192px, 0px);
|
||||
}
|
||||
|
||||
/* Popup Title */
|
||||
#identity-popup-title {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-title {
|
||||
color: #6A6;
|
||||
}
|
||||
|
||||
.unknownIdentity > #identity-popup-title {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.verifiedDomain > #identity-popup-title {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* Popup Body Text */
|
||||
#identity-popup-content-box > description,
|
||||
#identity-popup-encryption-label {
|
||||
white-space: -moz-pre-wrap;
|
||||
color: black;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#identity-popup-content {
|
||||
padding-top: 5px;
|
||||
margin-bottom: 0;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-content,
|
||||
.verifiedDomain > #identity-popup-content {
|
||||
font-size: 140%;
|
||||
font-weight: bold;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
#identity-popup-encryption {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-encryption > * > #identity-popup-encryption-icon,
|
||||
.verifiedDomain > #identity-popup-encryption > * >#identity-popup-encryption-icon {
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
}
|
||||
|
||||
/* Popup Bounding Box */
|
||||
#identity-popup-container {
|
||||
background-image: none;
|
||||
background-color: white;
|
||||
min-width: 280px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ classic.jar:
|
|||
skin/classic/browser/find.png
|
||||
skin/classic/browser/find-bar-background.png
|
||||
skin/classic/browser/Go.png
|
||||
skin/classic/browser/identity.png
|
||||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/page-livemarks.png
|
||||
skin/classic/browser/livemark-item.png
|
||||
|
@ -48,6 +49,7 @@ classic.jar:
|
|||
skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
||||
skin/classic/browser/places/starPage.png (places/starPage.png)
|
||||
skin/classic/browser/places/pageStarred.png (places/pageStarred.png)
|
||||
skin/classic/browser/places/tag.png (places/tag.png)
|
||||
skin/classic/browser/places/organizer-toolbar.png (bookmarks/Bookmarks-toolbar.png)
|
||||
skin/classic/browser/places/expander-closed-active.png (bookmarks/expander-closed-active.png)
|
||||
skin/classic/browser/places/expander-closed.png (bookmarks/expander-closed.png)
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 586 B |
|
@ -114,14 +114,14 @@ radio[pane=paneContent][selected="true"] {
|
|||
-moz-image-region: rect(32px, 96px, 64px, 64px);
|
||||
}
|
||||
|
||||
/* ----- FEEDS BUTTON ----- */
|
||||
/* ----- APPLICATIONS BUTTON ----- */
|
||||
|
||||
radio[pane=paneFeeds] {
|
||||
radio[pane=paneApplications] {
|
||||
-moz-image-region: rect(0px, 128px, 32px, 96px);
|
||||
}
|
||||
radio[pane=paneFeeds]:hover,
|
||||
radio[pane=paneFeeds]:active,
|
||||
radio[pane=paneFeeds][selected="true"] {
|
||||
radio[pane=paneApplications]:hover,
|
||||
radio[pane=paneApplications]:active,
|
||||
radio[pane=paneApplications][selected="true"] {
|
||||
-moz-image-region: rect(32px, 128px, 64px, 96px);
|
||||
}
|
||||
|
||||
|
@ -276,11 +276,3 @@ caption {
|
|||
.updateControls {
|
||||
-moz-margin-start: 10px;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Feeds pane
|
||||
*/
|
||||
#chooseClientAppCell {
|
||||
-moz-padding-end: 12px;
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active {
|
|||
margin-bottom: 2px;
|
||||
margin-top: 2px;
|
||||
-moz-margin-end: 0px;
|
||||
-moz-margin-start: 3px;
|
||||
-moz-margin-start: 0px;
|
||||
width: 7em;
|
||||
min-width: 7em;
|
||||
|
||||
|
@ -972,13 +972,6 @@ statusbarpanel#statusbar-display {
|
|||
|
||||
#treecolAutoCompleteImage {
|
||||
max-width : 36px;
|
||||
padding-end: 18px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(favicon, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/starPage.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
|
||||
|
@ -987,6 +980,12 @@ statusbarpanel#statusbar-display {
|
|||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-image(tag, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/tag.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
color: #555566;
|
||||
}
|
||||
|
@ -1810,43 +1809,6 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
|
|||
color: #000000;
|
||||
}
|
||||
|
||||
#urlbar[level="high"] #lock-icon {
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="high"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="high"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="low"] #lock-icon {
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="low"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="low"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
}
|
||||
#urlbar[level="broken"] #lock-icon {
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Security-broken.png");
|
||||
}
|
||||
#urlbar[level="broken"] #lock-icon:hover {
|
||||
-moz-image-region: rect(18px, 18px, 36px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Security-broken.png");
|
||||
}
|
||||
#urlbar[level="broken"] #lock-icon:active {
|
||||
-moz-image-region: rect(36px, 18px, 54px, 0px);
|
||||
list-style-image: url("chrome://browser/skin/Security-broken.png");
|
||||
}
|
||||
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
#urlbar > .autocomplete-textbox-container {
|
||||
-moz-binding: url(chrome://browser/skin/browser.xml#autocomplete-security-wrapper);
|
||||
|
@ -1959,3 +1921,105 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
|||
.bookmark-item[dragover-bottom="true"] {
|
||||
-moz-border-bottom-colors: #000000;
|
||||
}
|
||||
|
||||
/* ::::: Identity Indicator Styling ::::: */
|
||||
/* Location bar visuals*/
|
||||
#identity-box {
|
||||
border-right: 1px solid #888;
|
||||
background-color: white;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
#identity-box:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
#identity-box.verifiedIdentity {
|
||||
background-color: #BFA;
|
||||
}
|
||||
|
||||
#identity-icon-label {
|
||||
padding: 1px 2px 2px;
|
||||
margin: 0;
|
||||
color: black;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.unknownIdentity > #identity-icon-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Popup Icons */
|
||||
#identity-popup-icon {
|
||||
height: 64px;
|
||||
width: 64px;
|
||||
padding: 0;
|
||||
margin: 10px 0 0;
|
||||
list-style-image: url("chrome://browser/skin/identity.png");
|
||||
-moz-image-region: rect(0px, 64px, 64px, 0px);
|
||||
}
|
||||
|
||||
.verifiedDomain > #identity-popup-container > #identity-popup-icon {
|
||||
-moz-image-region: rect(64px, 64px, 128px, 0px);
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-container > #identity-popup-icon {
|
||||
-moz-image-region: rect(128px, 64px, 192px, 0px);
|
||||
}
|
||||
|
||||
/* Popup Title */
|
||||
#identity-popup-title {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-title {
|
||||
color: #6A6;
|
||||
}
|
||||
|
||||
.unknownIdentity > #identity-popup-title {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.verifiedDomain > #identity-popup-title {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* Popup Body Text */
|
||||
#identity-popup-content-box > description,
|
||||
#identity-popup-encryption-label {
|
||||
white-space: -moz-pre-wrap;
|
||||
color: black;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#identity-popup-content {
|
||||
padding-top: 5px;
|
||||
margin-bottom: 0;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-content,
|
||||
.verifiedDomain > #identity-popup-content {
|
||||
font-size: 140%;
|
||||
font-weight: bold;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
#identity-popup-encryption {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.verifiedIdentity > #identity-popup-encryption > * > #identity-popup-encryption-icon,
|
||||
.verifiedDomain > #identity-popup-encryption > * >#identity-popup-encryption-icon {
|
||||
list-style-image: url("chrome://browser/skin/Secure.png");
|
||||
-moz-image-region: rect(0px, 18px, 18px, 0px);
|
||||
}
|
||||
|
||||
/* Popup Bounding Box */
|
||||
#identity-popup-container {
|
||||
background-image: none;
|
||||
background-color: white;
|
||||
min-width: 280px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ classic.jar:
|
|||
skin/classic/browser/browser.xml
|
||||
* skin/classic/browser/engineManager.css (engineManager.css)
|
||||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/identity.png
|
||||
skin/classic/browser/pageInfo.css
|
||||
skin/classic/browser/pageInfo.png
|
||||
skin/classic/browser/page-livemarks.png
|
||||
|
@ -54,6 +55,7 @@ classic.jar:
|
|||
skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
||||
skin/classic/browser/places/starPage.png (places/starPage.png)
|
||||
skin/classic/browser/places/pageStarred.png (places/pageStarred.png)
|
||||
skin/classic/browser/places/tag.png (places/tag.png)
|
||||
skin/classic/browser/places/bookmarkProperties.css (places/bookmarkProperties.css)
|
||||
skin/classic/browser/places/organizer-toolbar.png (bookmarks/Bookmarks-toolbar.png)
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 586 B |
|
@ -67,11 +67,11 @@ radio[pane=paneContent][selected="true"] {
|
|||
-moz-image-region: rect(32px, 96px, 64px, 64px)
|
||||
}
|
||||
|
||||
radio[pane=paneFeeds] {
|
||||
radio[pane=paneApplications] {
|
||||
-moz-image-region: rect(0px, 128px, 32px, 96px)
|
||||
}
|
||||
radio[pane=paneFeeds]:hover,
|
||||
radio[pane=paneFeeds][selected="true"] {
|
||||
radio[pane=paneApplications]:hover,
|
||||
radio[pane=paneApplications][selected="true"] {
|
||||
-moz-image-region: rect(32px, 128px, 64px, 96px)
|
||||
}
|
||||
|
||||
|
@ -191,80 +191,6 @@ filefield[disabled="true"] .fileFieldIcon {
|
|||
background-color: #E9E7E3;
|
||||
}
|
||||
|
||||
/* Download Actions Manager */
|
||||
#fileExtension {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
#extensionChildren::-moz-tree-image(fileExtension) {
|
||||
margin: 0px 5px 0px 0px;
|
||||
}
|
||||
|
||||
#typeField {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Change Action Dialog */
|
||||
#typeIcon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
-moz-margin-end: 3px;
|
||||
}
|
||||
|
||||
#typeField {
|
||||
background-color: transparent;
|
||||
margin-top: 1px !important;
|
||||
margin-bottom: 2px !important;
|
||||
-moz-margin-start: 6px !important;
|
||||
-moz-margin-end: 5px !important;
|
||||
}
|
||||
|
||||
#extensionField {
|
||||
color: GrayText;
|
||||
font-weight: bold;
|
||||
}
|
||||
#ChangeActionDialog {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#ChangeActionDialog .dialog-button-box {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 10px;
|
||||
-moz-padding-start: 8px;
|
||||
-moz-padding-end: 10px;
|
||||
}
|
||||
|
||||
#changeActionHeader {
|
||||
border-bottom: 2px groove ThreeDFace;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
background-color: -moz-Field;
|
||||
color: -moz-FieldText;
|
||||
}
|
||||
|
||||
#changeActionContent {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 10px;
|
||||
-moz-padding-start: 9px;
|
||||
-moz-padding-end: 10px;
|
||||
}
|
||||
|
||||
#defaultAppIcon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
-moz-margin-start: 2px;
|
||||
}
|
||||
|
||||
#defaultAppName {
|
||||
-moz-margin-start: 6px !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Feeds pane */
|
||||
#chooseClientAppCell {
|
||||
-moz-padding-end: 12px;
|
||||
}
|
||||
|
||||
/* bottom-most box containing a groupbox in a prefpane. Prevents the bottom
|
||||
of the groupbox from being cutoff */
|
||||
.bottomBox {
|
||||
|
|
|
@ -545,6 +545,9 @@ private:
|
|||
*/
|
||||
PRBool SecurityCompareURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
|
||||
|
||||
/* encapsulate the file comparison rules */
|
||||
PRBool SecurityCompareFileURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
|
||||
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
// While this header is included outside of caps, this class isn't
|
||||
// referenced so this should be fine.
|
||||
|
@ -560,10 +563,11 @@ private:
|
|||
static jsval sEnabledID;
|
||||
|
||||
inline void
|
||||
JSEnabledPrefChanged(nsISecurityPref* aSecurityPref);
|
||||
ScriptSecurityPrefChanged();
|
||||
|
||||
static const char sJSEnabledPrefName[];
|
||||
static const char sJSMailEnabledPrefName[];
|
||||
static const char sFileOriginPolicyPrefName[];
|
||||
|
||||
nsObjectHashtable* mOriginToPolicyMap;
|
||||
DomainPolicy* mDefaultPolicy;
|
||||
|
@ -583,6 +587,7 @@ private:
|
|||
PRPackedBool mXPCDefaultGrantAll;
|
||||
static const char sXPCDefaultGrantAllName[];
|
||||
#endif
|
||||
PRInt32 mFileURIOriginPolicy;
|
||||
|
||||
static nsIIOService *sIOService;
|
||||
static nsIXPConnect *sXPConnect;
|
||||
|
@ -590,4 +595,16 @@ private:
|
|||
static JSRuntime *sRuntime;
|
||||
};
|
||||
|
||||
// Levels for file: URI same-origin policy:
|
||||
// self: same-origin only with itself
|
||||
// samedir: same-origin with files having the same path
|
||||
// subdir: same-origin with files having longer paths (asymetric)
|
||||
// anyfile: same-origin with any other file: URI (but not directories)
|
||||
// traditional: any local file, any directory
|
||||
#define FILEURI_SOP_SELF 0
|
||||
#define FILEURI_SOP_SAMEDIR 1
|
||||
#define FILEURI_SOP_SUBDIR 2
|
||||
#define FILEURI_SOP_ANYFILE 3
|
||||
#define FILEURI_SOP_TRADITIONAL 4
|
||||
|
||||
#endif // nsScriptSecurityManager_h__
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "nsIProperties.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsIJAR.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
|
@ -268,7 +269,6 @@ nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
|||
|
||||
// If either URI is a nested URI, get the base URI
|
||||
nsCOMPtr<nsIURI> sourceBaseURI = NS_GetInnermostURI(aSourceURI);
|
||||
|
||||
nsCOMPtr<nsIURI> targetBaseURI = NS_GetInnermostURI(aTargetURI);
|
||||
|
||||
if (!sourceBaseURI || !targetBaseURI)
|
||||
|
@ -276,20 +276,20 @@ nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
|||
|
||||
// Compare schemes
|
||||
nsCAutoString targetScheme;
|
||||
nsresult rv = targetBaseURI->GetScheme(targetScheme);
|
||||
nsCAutoString sourceScheme;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = sourceBaseURI->GetScheme(sourceScheme);
|
||||
if (NS_FAILED(rv) || !targetScheme.Equals(sourceScheme)) {
|
||||
PRBool sameScheme = PR_FALSE;
|
||||
if (NS_FAILED( targetBaseURI->GetScheme(targetScheme) ) ||
|
||||
NS_FAILED( sourceBaseURI->SchemeIs(targetScheme.get(), &sameScheme) ) ||
|
||||
!sameScheme)
|
||||
{
|
||||
// Not same-origin if schemes differ
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (targetScheme.EqualsLiteral("file"))
|
||||
{
|
||||
// All file: urls are considered to have the same origin.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// special handling for file: URIs
|
||||
if (targetScheme.EqualsLiteral("file"))
|
||||
return SecurityCompareFileURIs( sourceBaseURI, targetBaseURI );
|
||||
|
||||
// Special handling for mailnews schemes
|
||||
if (targetScheme.EqualsLiteral("imap") ||
|
||||
targetScheme.EqualsLiteral("mailbox") ||
|
||||
targetScheme.EqualsLiteral("news"))
|
||||
|
@ -297,28 +297,26 @@ nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
|||
// Each message is a distinct trust domain; use the
|
||||
// whole spec for comparison
|
||||
nsCAutoString targetSpec;
|
||||
if (NS_FAILED(targetBaseURI->GetSpec(targetSpec)))
|
||||
return PR_FALSE;
|
||||
nsCAutoString sourceSpec;
|
||||
if (NS_FAILED(sourceBaseURI->GetSpec(sourceSpec)))
|
||||
return PR_FALSE;
|
||||
return targetSpec.Equals(sourceSpec);
|
||||
return ( NS_SUCCEEDED( targetBaseURI->GetSpec(targetSpec) ) &&
|
||||
NS_SUCCEEDED( sourceBaseURI->GetSpec(sourceSpec) ) &&
|
||||
targetSpec.Equals(sourceSpec) );
|
||||
}
|
||||
|
||||
// Compare hosts
|
||||
nsCAutoString targetHost;
|
||||
rv = targetBaseURI->GetHost(targetHost);
|
||||
nsCAutoString sourceHost;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = sourceBaseURI->GetHost(sourceHost);
|
||||
if (NS_FAILED(rv) ||
|
||||
!targetHost.Equals(sourceHost, nsCaseInsensitiveCStringComparator())) {
|
||||
if (NS_FAILED( targetBaseURI->GetHost(targetHost) ) ||
|
||||
NS_FAILED( sourceBaseURI->GetHost(sourceHost) ) ||
|
||||
!targetHost.Equals(sourceHost, nsCaseInsensitiveCStringComparator()))
|
||||
{
|
||||
// Not same-origin if hosts differ
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Compare ports
|
||||
PRInt32 targetPort;
|
||||
rv = targetBaseURI->GetPort(&targetPort);
|
||||
nsresult rv = targetBaseURI->GetPort(&targetPort);
|
||||
PRInt32 sourcePort;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = sourceBaseURI->GetPort(&sourcePort);
|
||||
|
@ -331,18 +329,15 @@ nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
|||
{
|
||||
NS_ENSURE_STATE(sIOService);
|
||||
|
||||
NS_ASSERTION(targetScheme.Equals(sourceScheme),
|
||||
"Schemes should be equal here");
|
||||
|
||||
PRInt32 defaultPort;
|
||||
nsCOMPtr<nsIProtocolHandler> protocolHandler;
|
||||
rv = sIOService->GetProtocolHandler(sourceScheme.get(),
|
||||
rv = sIOService->GetProtocolHandler(targetScheme.get(),
|
||||
getter_AddRefs(protocolHandler));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
rv = protocolHandler->GetDefaultPort(&defaultPort);
|
||||
if (NS_FAILED(rv) || defaultPort == -1)
|
||||
return PR_FALSE; // No default port for this scheme
|
||||
|
@ -357,6 +352,83 @@ nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
|||
return result;
|
||||
}
|
||||
|
||||
// helper function for SecurityCompareURIs
|
||||
PRBool
|
||||
nsScriptSecurityManager::SecurityCompareFileURIs(nsIURI* aSourceURI,
|
||||
nsIURI* aTargetURI)
|
||||
{
|
||||
// in traditional unsafe behavior all files are the same origin
|
||||
if (mFileURIOriginPolicy == FILEURI_SOP_TRADITIONAL)
|
||||
return PR_TRUE;
|
||||
|
||||
|
||||
// Check simplest and default FILEURI_SOP_SELF case first:
|
||||
// If they're equal or if the policy says they must be, we're done
|
||||
PRBool filesAreEqual = PR_FALSE;
|
||||
if (NS_FAILED( aSourceURI->Equals(aTargetURI, &filesAreEqual) ))
|
||||
return PR_FALSE;
|
||||
if (filesAreEqual || mFileURIOriginPolicy == FILEURI_SOP_SELF)
|
||||
return filesAreEqual;
|
||||
|
||||
|
||||
// disallow access to directory listings (bug 209234)
|
||||
PRBool targetIsDir = PR_TRUE;
|
||||
nsCOMPtr<nsIFile> targetFile;
|
||||
nsCOMPtr<nsIFileURL> targetFileURL( do_QueryInterface(aTargetURI) );
|
||||
|
||||
if (!targetFileURL ||
|
||||
NS_FAILED( targetFileURL->GetFile(getter_AddRefs(targetFile)) ) ||
|
||||
NS_FAILED( targetFile->IsDirectory(&targetIsDir) ) ||
|
||||
targetIsDir)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
// For policy ANYFILE we're done
|
||||
if (mFileURIOriginPolicy == FILEURI_SOP_ANYFILE)
|
||||
return PR_TRUE;
|
||||
|
||||
|
||||
// source parent directory is needed for remaining policies
|
||||
nsCOMPtr<nsIFile> sourceFile;
|
||||
nsCOMPtr<nsIFile> sourceParent;
|
||||
nsCOMPtr<nsIFileURL> sourceFileURL( do_QueryInterface(aSourceURI) );
|
||||
|
||||
if (!sourceFileURL ||
|
||||
NS_FAILED( sourceFileURL->GetFile(getter_AddRefs(sourceFile)) ) ||
|
||||
NS_FAILED( sourceFile->GetParent(getter_AddRefs(sourceParent)) ) ||
|
||||
!sourceParent)
|
||||
{
|
||||
// unexpected error
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// check remaining policies
|
||||
if (mFileURIOriginPolicy == FILEURI_SOP_SAMEDIR)
|
||||
{
|
||||
// file: URIs in the same directory have the same origin
|
||||
PRBool sameParent = PR_FALSE;
|
||||
nsCOMPtr<nsIFile> targetParent;
|
||||
if (NS_FAILED( targetFile->GetParent(getter_AddRefs(targetParent)) ) ||
|
||||
NS_FAILED( sourceParent->Equals(targetParent, &sameParent) ))
|
||||
return PR_FALSE;
|
||||
return sameParent;
|
||||
}
|
||||
|
||||
if (mFileURIOriginPolicy == FILEURI_SOP_SUBDIR)
|
||||
{
|
||||
// file: URIs can access files in the same or lower directories
|
||||
PRBool isChild = PR_FALSE;
|
||||
if (NS_FAILED( sourceParent->Contains(targetFile, PR_TRUE, &isChild) ))
|
||||
return PR_FALSE;
|
||||
return isChild;
|
||||
}
|
||||
|
||||
NS_NOTREACHED("invalid file uri policy setting");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetChannelPrincipal(nsIChannel* aChannel,
|
||||
nsIPrincipal** aPrincipal)
|
||||
|
@ -3071,16 +3143,19 @@ nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic,
|
|||
const char *message = messageStr.get();
|
||||
|
||||
static const char jsPrefix[] = "javascript.";
|
||||
if((PL_strncmp(message, jsPrefix, sizeof(jsPrefix)-1) == 0)
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
|| (PL_strcmp(message, sXPCDefaultGrantAllName) == 0)
|
||||
#endif
|
||||
)
|
||||
JSEnabledPrefChanged(mSecurityPref);
|
||||
if(PL_strncmp(message, sPolicyPrefix, sizeof(sPolicyPrefix)-1) == 0)
|
||||
mPolicyPrefsChanged = PR_TRUE; // This will force re-initialization of the pref table
|
||||
else if((PL_strncmp(message, sPrincipalPrefix, sizeof(sPrincipalPrefix)-1) == 0) &&
|
||||
!mIsWritingPrefs)
|
||||
static const char securityPrefix[] = "security.";
|
||||
if ((PL_strncmp(message, jsPrefix, sizeof(jsPrefix)-1) == 0) ||
|
||||
(PL_strncmp(message, securityPrefix, sizeof(securityPrefix)-1) == 0) )
|
||||
{
|
||||
ScriptSecurityPrefChanged();
|
||||
}
|
||||
else if (PL_strncmp(message, sPolicyPrefix, sizeof(sPolicyPrefix)-1) == 0)
|
||||
{
|
||||
// This will force re-initialization of the pref table
|
||||
mPolicyPrefsChanged = PR_TRUE;
|
||||
}
|
||||
else if ((PL_strncmp(message, sPrincipalPrefix, sizeof(sPrincipalPrefix)-1) == 0) &&
|
||||
!mIsWritingPrefs)
|
||||
{
|
||||
static const char id[] = "id";
|
||||
char* lastDot = PL_strrchr(message, '.');
|
||||
|
@ -3105,10 +3180,11 @@ nsScriptSecurityManager::nsScriptSecurityManager(void)
|
|||
mIsJavaScriptEnabled(PR_FALSE),
|
||||
mIsMailJavaScriptEnabled(PR_FALSE),
|
||||
mIsWritingPrefs(PR_FALSE),
|
||||
mPolicyPrefsChanged(PR_TRUE)
|
||||
mPolicyPrefsChanged(PR_TRUE),
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
,mXPCDefaultGrantAll(PR_FALSE)
|
||||
mXPCDefaultGrantAll(PR_FALSE),
|
||||
#endif
|
||||
mFileURIOriginPolicy(FILEURI_SOP_SELF)
|
||||
{
|
||||
NS_ASSERTION(sizeof(long) == sizeof(void*), "long and void* have different lengths on this platform. This may cause a security failure.");
|
||||
mPrincipals.Init(31);
|
||||
|
@ -3697,13 +3773,15 @@ const char nsScriptSecurityManager::sJSEnabledPrefName[] =
|
|||
"javascript.enabled";
|
||||
const char nsScriptSecurityManager::sJSMailEnabledPrefName[] =
|
||||
"javascript.allow.mailnews";
|
||||
const char nsScriptSecurityManager::sFileOriginPolicyPrefName[] =
|
||||
"security.fileuri.origin_policy";
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
const char nsScriptSecurityManager::sXPCDefaultGrantAllName[] =
|
||||
"security.classID.allowByDefault";
|
||||
#endif
|
||||
|
||||
inline void
|
||||
nsScriptSecurityManager::JSEnabledPrefChanged(nsISecurityPref* aSecurityPref)
|
||||
nsScriptSecurityManager::ScriptSecurityPrefChanged()
|
||||
{
|
||||
PRBool temp;
|
||||
nsresult rv = mSecurityPref->SecurityGetBoolPref(sJSEnabledPrefName, &temp);
|
||||
|
@ -3711,8 +3789,12 @@ nsScriptSecurityManager::JSEnabledPrefChanged(nsISecurityPref* aSecurityPref)
|
|||
mIsJavaScriptEnabled = NS_FAILED(rv) || temp;
|
||||
|
||||
rv = mSecurityPref->SecurityGetBoolPref(sJSMailEnabledPrefName, &temp);
|
||||
// JavaScript in Mail defaults to enabled in failure cases.
|
||||
mIsMailJavaScriptEnabled = NS_FAILED(rv) || temp;
|
||||
// JavaScript in Mail defaults to disabled in failure cases.
|
||||
mIsMailJavaScriptEnabled = NS_SUCCEEDED(rv) && temp;
|
||||
|
||||
PRInt32 policy;
|
||||
rv = mSecurityPref->SecurityGetIntPref(sFileOriginPolicyPrefName, &policy);
|
||||
mFileURIOriginPolicy = NS_SUCCEEDED(rv) ? policy : FILEURI_SOP_SELF;
|
||||
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
rv = mSecurityPref->SecurityGetBoolPref(sXPCDefaultGrantAllName, &temp);
|
||||
|
@ -3735,10 +3817,11 @@ nsScriptSecurityManager::InitPrefs()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set the initial value of the "javascript.enabled" prefs
|
||||
JSEnabledPrefChanged(mSecurityPref);
|
||||
ScriptSecurityPrefChanged();
|
||||
// set observer callbacks in case the value of the prefs change
|
||||
prefBranchInternal->AddObserver(sJSEnabledPrefName, this, PR_FALSE);
|
||||
prefBranchInternal->AddObserver(sJSMailEnabledPrefName, this, PR_FALSE);
|
||||
prefBranchInternal->AddObserver(sFileOriginPolicyPrefName, this, PR_FALSE);
|
||||
#ifdef XPC_IDISPATCH_SUPPORT
|
||||
prefBranchInternal->AddObserver(sXPCDefaultGrantAllName, this, PR_FALSE);
|
||||
#endif
|
||||
|
|
|
@ -7040,7 +7040,7 @@ if test "$MOZ_SVG" -o "$MOZ_ENABLE_CANVAS" -o "$MOZ_ENABLE_CAIRO_GFX" ; then
|
|||
MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
|
||||
fi
|
||||
else
|
||||
MOZ_CAIRO_LIBS='-L$(DEPTH)/gfx/cairo/cairo/src -lmozcairo -L$(DEPTH)/gfx/cairo/libpixman/src -lmozlibpixman'" $CAIRO_FT_LIBS"
|
||||
MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
|
||||
|
||||
if test "$MOZ_X11"; then
|
||||
MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsStringGlue.h"
|
||||
#include "nsIDocumentObserver.h" // for nsUpdateType
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
|
@ -95,8 +96,8 @@ class mozAutoSubtreeModified;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x6700e22b, 0x95b8, 0x44cf, \
|
||||
{ 0x8f, 0x5a, 0x57, 0x2c, 0x14, 0x5b, 0xd1, 0xa1 } }
|
||||
{ 0x9a26d0aa, 0x37d2, 0x4313, \
|
||||
{ 0x9e, 0x53, 0x16, 0xd1, 0xa4, 0x67, 0xb3, 0x5b } }
|
||||
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
|
@ -853,7 +854,12 @@ public:
|
|||
*
|
||||
* @param aTarget is the target for the mutation event.
|
||||
*/
|
||||
virtual void MayDispatchMutationEvent(nsINode* aTarget) = 0;
|
||||
void MayDispatchMutationEvent(nsINode* aTarget)
|
||||
{
|
||||
if (mSubtreeModifiedDepth > 0) {
|
||||
mSubtreeModifiedTargets.AppendObject(aTarget);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks as not-going-to-be-collected for the given generation of
|
||||
|
@ -962,6 +968,9 @@ protected:
|
|||
PRUint32 mMarkedCCGeneration;
|
||||
|
||||
nsTObserverArray<nsIPresShell> mPresShells;
|
||||
|
||||
nsCOMArray<nsINode> mSubtreeModifiedTargets;
|
||||
PRUint32 mSubtreeModifiedDepth;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)
|
||||
|
|
|
@ -45,8 +45,8 @@ class nsIDocument;
|
|||
class nsINode;
|
||||
|
||||
#define NS_IMUTATION_OBSERVER_IID \
|
||||
{ 0x93542eb8, 0x98e1, 0x46f6, \
|
||||
{ 0xbb, 0xa2, 0x90, 0x54, 0x05, 0xfe, 0xbe, 0xf9 } }
|
||||
{ 0x32e68316, 0x67d4, 0x44a5, \
|
||||
{ 0x8d, 0x35, 0xd, 0x39, 0xf, 0xa9, 0xdf, 0x11 } }
|
||||
|
||||
/**
|
||||
* Information details about a characterdata change
|
||||
|
@ -75,6 +75,22 @@ class nsIMutationObserver : public nsISupports
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMUTATION_OBSERVER_IID)
|
||||
|
||||
/**
|
||||
* Notification that the node value of a data node (text, cdata, pi, comment)
|
||||
* will be changed.
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document (the other notifications are used
|
||||
* for that).
|
||||
*
|
||||
* @param aDocument The owner-document of aContent. Can be null.
|
||||
* @param aContent The piece of content that changed. Is never null.
|
||||
* @param aInfo The structure with information details about the change.
|
||||
*/
|
||||
virtual void CharacterDataWillChange(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the node value of a data node (text, cdata, pi, comment)
|
||||
* has changed.
|
||||
|
@ -85,7 +101,7 @@ public:
|
|||
*
|
||||
* @param aDocument The owner-document of aContent. Can be null.
|
||||
* @param aContent The piece of content that changed. Is never null.
|
||||
* @param aAppend Whether the change was an append
|
||||
* @param aInfo The structure with information details about the change.
|
||||
*/
|
||||
virtual void CharacterDataChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
|
@ -194,6 +210,11 @@ public:
|
|||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
|
||||
|
||||
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE \
|
||||
virtual void CharacterDataWillChange(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
CharacterDataChangeInfo* aInfo);
|
||||
|
||||
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED \
|
||||
virtual void CharacterDataChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
|
@ -231,6 +252,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
|
|||
virtual void ParentChainChanged(nsIContent *aContent);
|
||||
|
||||
#define NS_DECL_NSIMUTATIONOBSERVER \
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE \
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED \
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \
|
||||
|
@ -247,6 +269,12 @@ _class::NodeWillBeDestroyed(const nsINode* aNode)
|
|||
|
||||
#define NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) \
|
||||
void \
|
||||
_class::CharacterDataWillChange(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
CharacterDataChangeInfo* aInfo) \
|
||||
{ \
|
||||
} \
|
||||
void \
|
||||
_class::CharacterDataChanged(nsIDocument* aDocument, \
|
||||
nsIContent* aContent, \
|
||||
CharacterDataChangeInfo* aInfo) \
|
||||
|
|
|
@ -5756,14 +5756,6 @@ nsDocument::OnPageHide(PRBool aPersisted)
|
|||
mVisible = PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::MayDispatchMutationEvent(nsINode* aTarget)
|
||||
{
|
||||
if (mSubtreeModifiedDepth > 0) {
|
||||
mSubtreeModifiedTargets.AppendObject(aTarget);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::WillDispatchMutationEvent(nsINode* aTarget)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMDocumentEvent.h"
|
||||
#include "nsIDOM3DocumentEvent.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIBoxObject.h"
|
||||
|
@ -507,7 +506,6 @@ public:
|
|||
virtual void OnPageShow(PRBool aPersisted);
|
||||
virtual void OnPageHide(PRBool aPersisted);
|
||||
|
||||
virtual void MayDispatchMutationEvent(nsINode* aTarget);
|
||||
virtual void WillDispatchMutationEvent(nsINode* aTarget);
|
||||
virtual void MutationEventDispatched(nsINode* aTarget);
|
||||
|
||||
|
@ -819,9 +817,6 @@ private:
|
|||
// Member to store out last-selected stylesheet set.
|
||||
nsString mLastStyleSheetSet;
|
||||
|
||||
nsCOMArray<nsINode> mSubtreeModifiedTargets;
|
||||
PRUint32 mSubtreeModifiedDepth;
|
||||
|
||||
// Our update nesting level
|
||||
PRUint32 mUpdateNestLevel;
|
||||
};
|
||||
|
|
|
@ -423,6 +423,16 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
|
|||
endOffset = textLength;
|
||||
}
|
||||
|
||||
if (aNotify) {
|
||||
CharacterDataChangeInfo info = {
|
||||
aOffset == textLength,
|
||||
aOffset,
|
||||
endOffset,
|
||||
aLength
|
||||
};
|
||||
nsNodeUtils::CharacterDataWillChange(this, &info);
|
||||
}
|
||||
|
||||
if (aOffset == 0 && endOffset == textLength) {
|
||||
// Replacing whole text or old text was empty
|
||||
mText.SetTo(aBuffer, aLength);
|
||||
|
@ -460,6 +470,14 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
|
|||
|
||||
// Notify observers
|
||||
if (aNotify) {
|
||||
CharacterDataChangeInfo info = {
|
||||
aOffset == textLength,
|
||||
aOffset,
|
||||
endOffset,
|
||||
aLength
|
||||
};
|
||||
nsNodeUtils::CharacterDataChanged(this, &info);
|
||||
|
||||
if (haveMutationListeners) {
|
||||
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED);
|
||||
|
||||
|
@ -473,14 +491,6 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
|
|||
mozAutoSubtreeModified subtree(GetOwnerDoc(), this);
|
||||
nsEventDispatcher::Dispatch(this, nsnull, &mutation);
|
||||
}
|
||||
|
||||
CharacterDataChangeInfo info = {
|
||||
aOffset == textLength,
|
||||
aOffset,
|
||||
endOffset,
|
||||
aLength
|
||||
};
|
||||
nsNodeUtils::CharacterDataChanged(this, &info);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -79,6 +79,15 @@
|
|||
PR_END_MACRO
|
||||
|
||||
|
||||
void
|
||||
nsNodeUtils::CharacterDataWillChange(nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
{
|
||||
nsIDocument* doc = aContent->GetOwnerDoc();
|
||||
IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
|
||||
(doc, aContent, aInfo));
|
||||
}
|
||||
|
||||
void
|
||||
nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
|
|
|
@ -55,6 +55,15 @@ struct CharacterDataChangeInfo;
|
|||
class nsNodeUtils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Send CharacterDataWillChange notifications to nsIMutationObservers.
|
||||
* @param aContent Node whose data changed
|
||||
* @param aInfo Struct with information details about the change
|
||||
* @see nsIMutationObserver::CharacterDataWillChange
|
||||
*/
|
||||
static void CharacterDataWillChange(nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo);
|
||||
|
||||
/**
|
||||
* Send CharacterDataChanged notifications to nsIMutationObservers.
|
||||
* @param aContent Node whose data changed
|
||||
|
|
|
@ -142,6 +142,8 @@ nsAsyncInstantiateEvent::Run()
|
|||
mContent, mContentType.get(), mURI.get(), spec.get()));
|
||||
}
|
||||
|
||||
// We don't have to stop the plugin because we only use the event
|
||||
// for newly created frames that don't have a plugin loaded yet.
|
||||
nsresult rv = mContent->Instantiate(frame, mContentType, mURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
mContent->Fallback(PR_TRUE);
|
||||
|
@ -484,6 +486,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
|
|||
mInstantiating = PR_FALSE;
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
// We came here via eState_Loading. Therefore, our frame is newly
|
||||
// created, thus we don't have to stop the plugin.
|
||||
rv = frame->Instantiate(chan, getter_AddRefs(mFinalListener));
|
||||
mInstantiating = PR_FALSE;
|
||||
break;
|
||||
|
@ -1468,6 +1472,21 @@ nsObjectLoadingContent::TryInstantiate(const nsACString& aMIMEType,
|
|||
LOG(("OBJLC [%p]: Frame hasn't been reflown yet\n", this));
|
||||
return NS_OK; // Not a failure to have no frame
|
||||
}
|
||||
// Stop the plugin first. Since that might destroy the frame,
|
||||
// we have to get it again.
|
||||
frame->StopPlugin();
|
||||
|
||||
frame = GetFrame(PR_FALSE);
|
||||
if (!frame) {
|
||||
LOG(("OBJLC [%p]: No frame anymore\n", this));
|
||||
return NS_OK; // Not a failure to have no frame
|
||||
}
|
||||
CallQueryInterface(frame, &iframe);
|
||||
if (iframe->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
|
||||
LOG(("OBJLC [%p]: New frame hasn't been reflown yet\n", this));
|
||||
return NS_OK; // Not a failure to have no frame
|
||||
}
|
||||
|
||||
return Instantiate(frame, aMIMEType, aURI);
|
||||
}
|
||||
|
||||
|
|
|
@ -1503,10 +1503,29 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInp
|
|||
return inStr->ReadSegments(nsXMLHttpRequest::StreamReaderFunc, (void*)this, count, &totalRead);
|
||||
}
|
||||
|
||||
PRBool
|
||||
IsSameOrBaseChannel(nsIRequest* aPossibleBase, nsIChannel* aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIMultiPartChannel> mpChannel = do_QueryInterface(aPossibleBase);
|
||||
if (mpChannel) {
|
||||
nsCOMPtr<nsIChannel> baseChannel;
|
||||
nsresult rv = mpChannel->GetBaseChannel(getter_AddRefs(baseChannel));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
return baseChannel == aChannel;
|
||||
}
|
||||
|
||||
return aPossibleBase == aChannel;
|
||||
}
|
||||
|
||||
/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
if (!IsSameOrBaseChannel(request, mChannel)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Don't do anything if we have been aborted
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED)
|
||||
return NS_OK;
|
||||
|
@ -1520,7 +1539,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
NS_ENSURE_TRUE(channel, NS_ERROR_UNEXPECTED);
|
||||
|
||||
mChannel->SetOwner(mPrincipal);
|
||||
channel->SetOwner(mPrincipal);
|
||||
|
||||
mReadRequest = request;
|
||||
mContext = ctxt;
|
||||
|
@ -1617,6 +1636,10 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
|
||||
{
|
||||
if (!IsSameOrBaseChannel(request, mChannel)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Don't do anything if we have been aborted
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED)
|
||||
return NS_OK;
|
||||
|
|
|
@ -107,9 +107,4 @@ CXXFLAGS += -I$(topsrcdir)/gfx/src/mac
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT), os2)
|
||||
# needed for nsDrawingSurfaceOS2.h
|
||||
CXXFLAGS += -I$(topsrcdir)/gfx/src/os2
|
||||
endif
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
|
|
@ -138,14 +138,16 @@ public:
|
|||
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
|
||||
|
||||
nsCOMPtr<nsPIDOMEventTarget> mTarget;
|
||||
nsEventTargetChainItem* mChild;
|
||||
nsEventTargetChainItem* mParent;
|
||||
PRUint16 mFlags;
|
||||
PRUint16 mItemFlags;
|
||||
nsCOMPtr<nsISupports> mItemData;
|
||||
nsCOMPtr<nsPIDOMEventTarget> mTarget;
|
||||
nsEventTargetChainItem* mChild;
|
||||
nsEventTargetChainItem* mParent;
|
||||
PRUint16 mFlags;
|
||||
PRUint16 mItemFlags;
|
||||
nsCOMPtr<nsISupports> mItemData;
|
||||
// Event retargeting must happen whenever mNewTarget is non-null.
|
||||
nsCOMPtr<nsISupports> mNewTarget;
|
||||
nsCOMPtr<nsISupports> mNewTarget;
|
||||
// Cache mTarget's event listener manager.
|
||||
nsCOMPtr<nsIEventListenerManager> mManager;
|
||||
};
|
||||
|
||||
nsEventTargetChainItem::nsEventTargetChainItem(nsISupports* aTarget,
|
||||
|
@ -192,14 +194,18 @@ nsresult
|
|||
nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor& aVisitor,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsCOMPtr<nsIEventListenerManager> lm;
|
||||
mTarget->GetListenerManager(PR_FALSE, getter_AddRefs(lm));
|
||||
aVisitor.mEvent->currentTarget = CurrentTarget()->GetTargetForDOMEvent();
|
||||
if (lm && aVisitor.mEvent->currentTarget) {
|
||||
lm->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent, &aVisitor.mDOMEvent,
|
||||
aVisitor.mEvent->currentTarget, aFlags,
|
||||
&aVisitor.mEventStatus);
|
||||
aVisitor.mEvent->currentTarget = nsnull;
|
||||
if (!mManager) {
|
||||
mTarget->GetListenerManager(PR_FALSE, getter_AddRefs(mManager));
|
||||
}
|
||||
if (mManager) {
|
||||
aVisitor.mEvent->currentTarget = CurrentTarget()->GetTargetForDOMEvent();
|
||||
if (aVisitor.mEvent->currentTarget) {
|
||||
mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
|
||||
&aVisitor.mDOMEvent,
|
||||
aVisitor.mEvent->currentTarget, aFlags,
|
||||
&aVisitor.mEventStatus);
|
||||
aVisitor.mEvent->currentTarget = nsnull;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -5155,7 +5155,7 @@ nsEventStateManager::MoveCaretToFocus()
|
|||
nsCOMPtr<nsIDOMDocumentRange> rangeDoc(do_QueryInterface(mDocument));
|
||||
|
||||
if (rangeDoc) {
|
||||
nsISelection* domSelection = shell->FrameSelection()->
|
||||
nsCOMPtr<nsISelection> domSelection = shell->FrameSelection()->
|
||||
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
if (domSelection) {
|
||||
nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(mCurrentFocus));
|
||||
|
|
|
@ -347,6 +347,10 @@ nsXMLEventsManager::EndLoad(nsIDocument* aDocument)
|
|||
AddListeners(aDocument);
|
||||
}
|
||||
NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsXMLEventsManager)
|
||||
void
|
||||
nsXMLEventsManager::CharacterDataWillChange(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo) {}
|
||||
void
|
||||
nsXMLEventsManager::CharacterDataChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "nsStringStream.h"
|
||||
#include "nsIFormProcessor.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsLinebreakConverter.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
@ -532,29 +533,35 @@ nsFSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCAutoString path;
|
||||
rv = aURI->GetPath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 42616: Trim off named anchor and save it to add later
|
||||
PRInt32 namedAnchorPos = path.FindChar('#');
|
||||
nsCAutoString namedAnchor;
|
||||
if (kNotFound != namedAnchorPos) {
|
||||
path.Right(namedAnchor, (path.Length() - namedAnchorPos));
|
||||
path.Truncate(namedAnchorPos);
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
|
||||
if (url) {
|
||||
url->SetQuery(mQueryString);
|
||||
}
|
||||
else {
|
||||
nsCAutoString path;
|
||||
rv = aURI->GetPath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 42616: Trim off named anchor and save it to add later
|
||||
PRInt32 namedAnchorPos = path.FindChar('#');
|
||||
nsCAutoString namedAnchor;
|
||||
if (kNotFound != namedAnchorPos) {
|
||||
path.Right(namedAnchor, (path.Length() - namedAnchorPos));
|
||||
path.Truncate(namedAnchorPos);
|
||||
}
|
||||
|
||||
// Chop off old query string (bug 25330, 57333)
|
||||
// Only do this for GET not POST (bug 41585)
|
||||
PRInt32 queryStart = path.FindChar('?');
|
||||
if (kNotFound != queryStart) {
|
||||
path.Truncate(queryStart);
|
||||
// Chop off old query string (bug 25330, 57333)
|
||||
// Only do this for GET not POST (bug 41585)
|
||||
PRInt32 queryStart = path.FindChar('?');
|
||||
if (kNotFound != queryStart) {
|
||||
path.Truncate(queryStart);
|
||||
}
|
||||
|
||||
path.Append('?');
|
||||
// Bug 42616: Add named anchor to end after query string
|
||||
path.Append(mQueryString + namedAnchor);
|
||||
|
||||
aURI->SetPath(path);
|
||||
}
|
||||
|
||||
path.Append('?');
|
||||
// Bug 42616: Add named anchor to end after query string
|
||||
path.Append(mQueryString + namedAnchor);
|
||||
|
||||
aURI->SetPath(path);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -1769,6 +1769,7 @@ nsHTMLSelectElement::RebuildOptionsArray()
|
|||
{
|
||||
mOptions->Clear();
|
||||
AddOptionsRecurse(this, mOptions);
|
||||
FindSelectedIndex(0);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче