Merge mozilla-central into services-central

This commit is contained in:
Gregory Szorc 2012-07-03 09:55:45 -07:00
Родитель 947b2a0f1a 6a7d5cdcee
Коммит 59824469a6
1164 изменённых файлов: 5360 добавлений и 4497 удалений

Просмотреть файл

@ -15,7 +15,6 @@
class Accessible;
class nsINode;
class nsIContent;
class nsIDocument;
class nsIFrame;
class nsIPresShell;
class nsObjectFrame;

Просмотреть файл

@ -895,6 +895,10 @@ ShouldA11yBeEnabled()
sChecked = true;
EPlatformDisabledState disabledState = PlatformDisabledState();
if (disabledState == ePlatformIsDisabled)
return sShouldEnable = false;
// check if accessibility enabled/disabled by environment variable
const char* envValue = PR_GetEnv(sAccEnv);
if (envValue)

Просмотреть файл

@ -13,7 +13,6 @@
#include "nsAccEvent.h"
#include "States.h"
#include "nsIDOMDocument.h"
#include "nsEventStateManager.h"
#include "nsIServiceManager.h"
#ifdef MOZ_XUL

Просмотреть файл

@ -42,25 +42,14 @@
#include "Logging.h"
#endif
#include "nsCURILoader.h"
#include "nsEventStates.h"
#include "nsIContentViewer.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLLegendElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMXULElement.h"
#include "nsIHTMLDocument.h"
#include "nsImageFrame.h"
#include "nsILink.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
#include "nsNPAPIPluginInstance.h"
#include "nsISupportsUtils.h"
#include "nsObjectFrame.h"
#include "nsTextFragment.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"

Просмотреть файл

@ -258,45 +258,36 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
}
nsresult
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
PRUint32 aScrollType)
{
nsIPresShell::ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
return ScrollSubstringTo(aFrame, aStartNode, aStartIndex, aEndNode, aEndIndex,
vertical, horizontal);
return ScrollSubstringTo(aFrame, aRange, vertical, horizontal);
}
nsresult
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal)
{
if (!aFrame || !aStartNode || !aEndNode)
if (!aFrame)
return NS_ERROR_FAILURE;
nsPresContext *presContext = aFrame->PresContext();
nsRefPtr<nsIDOMRange> scrollToRange = new nsRange();
nsCOMPtr<nsISelectionController> selCon;
aFrame->GetSelectionController(presContext, getter_AddRefs(selCon));
NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
scrollToRange->SetStart(aStartNode, aStartIndex);
scrollToRange->SetEnd(aEndNode, aEndIndex);
nsCOMPtr<nsISelection> selection;
selCon->GetSelection(nsISelectionController::SELECTION_ACCESSIBILITY,
getter_AddRefs(selection));
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(selection));
selection->RemoveAllRanges();
selection->AddRange(scrollToRange);
selection->AddRange(aRange);
privSel->ScrollIntoViewInternal(
nsISelectionController::SELECTION_ANCHOR_REGION,

Просмотреть файл

@ -21,6 +21,8 @@
#include "nsPoint.h"
#include "nsTArray.h"
class nsRange;
/**
* Core utils.
*/
@ -129,31 +131,21 @@ public:
* nsIAccessibleText::scrollSubstringTo().
*
* @param aFrame the frame for accessible the range belongs to.
* @param aStartNode start node of a range
* @param aStartOffset an offset inside the start node
* @param aEndNode end node of a range
* @param aEndOffset an offset inside the end node
* @param aRange the range to scroll to
* @param aScrollType the place a range should be scrolled to
*/
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
PRUint32 aScrollType);
/** Helper method to scroll range into view, used for implementation of
* nsIAccessibleText::scrollSubstringTo[Point]().
*
* @param aFrame the frame for accessible the range belongs to.
* @param aStartNode start node of a range
* @param aStartOffset an offset inside the start node
* @param aEndNode end node of a range
* @param aEndOffset an offset inside the end node
* @param aRange the range to scroll to
* @param aVertical how to align vertically, specified in percents, and when.
* @param aHorizontal how to align horizontally, specified in percents, and when.
*/
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal);

Просмотреть файл

@ -16,10 +16,7 @@
#include "nsIClipboard.h"
#include "nsContentUtils.h"
#include "nsFocusManager.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
#include "nsIDOMXULDocument.h"
#include "nsIEditingSession.h"
#include "nsIEditor.h"
#include "nsIFrame.h"
@ -28,12 +25,12 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPlaintextEditor.h"
#include "nsIScrollableFrame.h"
#include "nsISelectionPrivate.h"
#include "nsIServiceManager.h"
#include "nsTextFragment.h"
#include "mozilla/Selection.h"
#include "gfxSkipChars.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -522,9 +519,7 @@ HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
// For text nodes, aNodeOffset comes in as a character offset
// Text offset will be added at the end, if we find the offset in this hypertext
// We want the "skipped" offset into the text (rendered text without the extra whitespace)
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
NS_ASSERTION(content, "No nsIContent for dom node");
nsIFrame *frame = content->GetPrimaryFrame();
nsIFrame *frame = aNode->AsContent()->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, nsnull);
nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &addTextOffset);
NS_ENSURE_SUCCESS(rv, nsnull);
@ -634,38 +629,11 @@ HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
return nsnull;
}
nsresult
HyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
nsIDOMNode** aNode,
PRInt32* aOffset)
{
nsCOMPtr<nsIDOMNode> endNode;
PRInt32 endOffset;
return HypertextOffsetsToDOMRange(aHTOffset, aHTOffset, aNode, aOffset,
getter_AddRefs(endNode), &endOffset);
}
nsresult
HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
PRInt32 aEndHTOffset,
nsIDOMNode** aStartNode,
PRInt32* aStartOffset,
nsIDOMNode** aEndNode,
PRInt32* aEndOffset)
nsRange* aRange)
{
NS_ENSURE_ARG_POINTER(aStartNode);
*aStartNode = nsnull;
NS_ENSURE_ARG_POINTER(aStartOffset);
*aStartOffset = -1;
NS_ENSURE_ARG_POINTER(aEndNode);
*aEndNode = nsnull;
NS_ENSURE_ARG_POINTER(aEndOffset);
*aEndOffset = -1;
// If the given offsets are 0 and associated editor is empty then return
// collapsed range with editor root element as range container.
if (aStartHTOffset == 0 && aEndHTOffset == 0) {
@ -677,11 +645,10 @@ HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
nsCOMPtr<nsIDOMElement> editorRootElm;
editor->GetRootElement(getter_AddRefs(editorRootElm));
nsCOMPtr<nsIDOMNode> editorRoot(do_QueryInterface(editorRootElm));
nsCOMPtr<nsINode> editorRoot(do_QueryInterface(editorRootElm));
if (editorRoot) {
*aStartOffset = *aEndOffset = 0;
NS_ADDREF(*aStartNode = editorRoot);
NS_ADDREF(*aEndNode = editorRoot);
aRange->SetStart(editorRoot, 0);
aRange->SetEnd(editorRoot, 0);
return NS_OK;
}
@ -698,28 +665,21 @@ HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
if (!startAcc || !endAcc)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> startNode, endNode;
DOMPoint startPoint, endPoint;
nsresult rv = GetDOMPointByFrameOffset(startFrame, startOffset, startAcc,
getter_AddRefs(startNode),
&startOffset);
&startPoint);
NS_ENSURE_SUCCESS(rv, rv);
if (aStartHTOffset != aEndHTOffset) {
rv = GetDOMPointByFrameOffset(endFrame, endOffset, endAcc,
getter_AddRefs(endNode), &endOffset);
NS_ENSURE_SUCCESS(rv, rv);
} else {
endNode = startNode;
endOffset = startOffset;
}
rv = aRange->SetStart(startPoint.node, startPoint.idx);
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aStartNode = startNode);
*aStartOffset = startOffset;
if (aStartHTOffset == aEndHTOffset)
return aRange->SetEnd(startPoint.node, startPoint.idx);
NS_ADDREF(*aEndNode = endNode);
*aEndOffset = endOffset;
rv = GetDOMPointByFrameOffset(endFrame, endOffset, endAcc, &endPoint);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
return aRange->SetEnd(endPoint.node, endPoint.idx);
}
PRInt32
@ -1555,18 +1515,12 @@ HyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRInt32 numRanges = 0;
domSel->GetRangeCount(&numRanges);
for (PRInt32 count = 0; count < numRanges - 1; count ++) {
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(1, getter_AddRefs(range));
domSel->RemoveRange(range);
}
for (PRInt32 idx = domSel->GetRangeCount() - 1; idx > 0; idx--)
domSel->RemoveRange(domSel->GetRangeAt(idx));
// When selection is done, move the focus to the selection if accessible is
// not focusable. That happens when selection is set within hypertext
@ -1625,21 +1579,15 @@ HyperTextAccessible::GetCaretOffset(PRInt32* aCaretOffset)
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsISelection* domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
nsCOMPtr<nsIDOMNode> focusDOMNode;
nsresult rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 focusOffset;
rv = domSel->GetFocusOffset(&focusOffset);
NS_ENSURE_SUCCESS(rv, rv);
nsINode* focusNode = domSel->GetFocusNode();
PRInt32 focusOffset = domSel->GetFocusOffset();
// No caret if this DOM node is inside of focused node but the selection's
// focus point is not inside of this DOM node.
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
if (focusDisp == FocusManager::eContainedByFocus) {
nsINode *resultNode =
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
@ -1663,19 +1611,21 @@ HyperTextAccessible::CaretLineNumber()
if (!frameSelection)
return -1;
nsISelection* domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
if (!domSel)
return - 1;
nsCOMPtr<nsIDOMNode> caretNode;
domSel->GetFocusNode(getter_AddRefs(caretNode));
nsCOMPtr<nsIContent> caretContent = do_QueryInterface(caretNode);
if (!caretContent || !nsCoreUtils::IsAncestorOf(GetNode(), caretContent))
nsINode* caretNode = domSel->GetFocusNode();
if (!caretNode || !caretNode->IsContent())
return -1;
PRInt32 caretOffset, returnOffsetUnused;
domSel->GetFocusOffset(&caretOffset);
nsIContent* caretContent = caretNode->AsContent();
if (!nsCoreUtils::IsAncestorOf(GetNode(), caretContent))
return -1;
PRInt32 returnOffsetUnused;
PRInt32 caretOffset = domSel->GetFocusOffset();
nsFrameSelection::HINT hint = frameSelection->GetHint();
nsIFrame *caretFrame = frameSelection->GetFrameForNodeOffset(caretContent, caretOffset,
hint, &returnOffsetUnused);
@ -1736,7 +1686,7 @@ HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
if (!frameSelection)
return;
nsISelection* domSel = frameSelection->GetSelection(aType);
Selection* domSel = frameSelection->GetSelection(aType);
if (!domSel)
return;
@ -1753,8 +1703,7 @@ HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
return;
PRUint32 childCount = startNode->GetChildCount();
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(domSel));
nsresult rv = privSel->
nsresult rv = domSel->
GetRangesForIntervalArray(startNode, 0, startNode, childCount, true, aRanges);
NS_ENSURE_SUCCESS(rv,);
@ -1842,43 +1791,32 @@ HyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
PRInt32 aStartOffset,
PRInt32 aEndOffset)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (aSelectionNum < 0)
return NS_ERROR_INVALID_ARG;
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRUint32 rangeCount = domSel->GetRangeCount();
if (rangeCount < static_cast<PRUint32>(aSelectionNum))
return NS_ERROR_INVALID_ARG;
// Caret is a collapsed selection
bool isOnlyCaret = (aStartOffset == aEndOffset);
PRInt32 rangeCount = 0;
domSel->GetRangeCount(&rangeCount);
nsCOMPtr<nsIDOMRange> range;
if (aSelectionNum == rangeCount) { // Add a range
nsRefPtr<nsRange> range;
if (aSelectionNum == rangeCount)
range = new nsRange();
}
else if (aSelectionNum < 0 || aSelectionNum > rangeCount) {
return NS_ERROR_INVALID_ARG;
}
else {
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
}
else
range = domSel->GetRangeAt(aSelectionNum);
PRInt32 startOffset = 0, endOffset = 0;
nsCOMPtr<nsIDOMNode> startNode, endNode;
nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset,
getter_AddRefs(startNode), &startOffset,
getter_AddRefs(endNode), &endOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = range->SetStart(startNode, startOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = isOnlyCaret ? range->Collapse(true) :
range->SetEnd(endNode, endOffset);
nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset, range);
NS_ENSURE_SUCCESS(rv, rv);
// If new range was created then add it, otherwise notify selection listeners
@ -1900,14 +1838,11 @@ HyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRInt32 rangeCount = 0;
domSel->GetRangeCount(&rangeCount);
return SetSelectionBounds(rangeCount, aStartOffset, aEndOffset);
return SetSelectionBounds(domSel->GetRangeCount(), aStartOffset, aEndOffset);
}
/*
@ -1919,18 +1854,14 @@ HyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRInt32 rangeCount;
domSel->GetRangeCount(&rangeCount);
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
if (aSelectionNum < 0 || aSelectionNum >= domSel->GetRangeCount())
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
return domSel->RemoveRange(range);
return domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum));
}
// void nsIAccessibleText::
@ -1940,18 +1871,14 @@ NS_IMETHODIMP
HyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
PRUint32 aScrollType)
{
PRInt32 startOffset, endOffset;
nsCOMPtr<nsIDOMNode> startNode, endNode;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex,
getter_AddRefs(startNode),
&startOffset,
getter_AddRefs(endNode),
&endOffset);
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
NS_ENSURE_SUCCESS(rv, rv);
return nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset, aScrollType);
return nsCoreUtils::ScrollSubstringTo(GetFrame(), range, aScrollType);
}
// void nsIAccessibleText::
@ -1973,12 +1900,8 @@ HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 startOffset, endOffset;
nsCOMPtr<nsIDOMNode> startNode, endNode;
rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex,
getter_AddRefs(startNode), &startOffset,
getter_AddRefs(endNode), &endOffset);
nsRefPtr<nsRange> range = new nsRange();
rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
NS_ENSURE_SUCCESS(rv, rv);
nsPresContext *presContext = frame->PresContext();
@ -2007,9 +1930,7 @@ HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
PRInt16 hPercent = offsetPoint.x * 100 / size.width;
PRInt16 vPercent = offsetPoint.y * 100 / size.height;
rv = nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset,
vPercent, hPercent);
rv = nsCoreUtils::ScrollSubstringTo(frame, range, vPercent, hPercent);
NS_ENSURE_SUCCESS(rv, rv);
initialScrolled = true;
@ -2229,16 +2150,12 @@ HyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
// HyperTextAccessible protected
nsresult
HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
PRInt32 aOffset,
HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame, PRInt32 aOffset,
Accessible* aAccessible,
nsIDOMNode** aNode,
PRInt32* aNodeOffset)
DOMPoint* aPoint)
{
NS_ENSURE_ARG(aAccessible);
nsCOMPtr<nsIDOMNode> node;
if (!aFrame) {
// If the given frame is null then set offset after the DOM node of the
// given accessible.
@ -2250,31 +2167,30 @@ HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
nsIContent* parent = content->GetParent();
*aNodeOffset = parent->IndexOf(content) + 1;
node = do_QueryInterface(parent);
aPoint->idx = parent->IndexOf(content) + 1;
aPoint->node = parent;
} else if (aFrame->GetType() == nsGkAtoms::textFrame) {
nsCOMPtr<nsIContent> content(aFrame->GetContent());
nsIContent* content = aFrame->GetContent();
NS_ENSURE_STATE(content);
nsIFrame *primaryFrame = content->GetPrimaryFrame();
nsresult rv = RenderedToContentOffset(primaryFrame, aOffset, aNodeOffset);
nsresult rv = RenderedToContentOffset(primaryFrame, aOffset, &(aPoint->idx));
NS_ENSURE_SUCCESS(rv, rv);
node = do_QueryInterface(content);
aPoint->node = content;
} else {
nsCOMPtr<nsIContent> content(aFrame->GetContent());
nsIContent* content = aFrame->GetContent();
NS_ENSURE_STATE(content);
nsCOMPtr<nsIContent> parent(content->GetParent());
nsIContent* parent = content->GetParent();
NS_ENSURE_STATE(parent);
*aNodeOffset = parent->IndexOf(content);
node = do_QueryInterface(parent);
aPoint->idx = parent->IndexOf(content);
aPoint->node = parent;
}
NS_IF_ADDREF(*aNode = node);
return NS_OK;
}

Просмотреть файл

@ -16,6 +16,15 @@
#include "nsFrameSelection.h"
#include "nsISelectionController.h"
namespace mozilla {
namespace a11y {
struct DOMPoint {
nsINode* node;
PRInt32 idx;
};
}
}
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
// This character marks where in the text returned via nsIAccessibleText(),
@ -130,33 +139,16 @@ public:
PRInt32* aHypertextOffset,
bool aIsEndOffset = false);
/**
* Turn a hypertext offsets into DOM point.
*
* @param aHTOffset [in] the given start hypertext offset
* @param aNode [out] start node
* @param aOffset [out] offset inside the start node
*/
nsresult HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
nsIDOMNode **aNode,
PRInt32 *aOffset);
/**
* Turn a start and end hypertext offsets into DOM range.
*
* @param aStartHTOffset [in] the given start hypertext offset
* @param aEndHTOffset [in] the given end hypertext offset
* @param aStartNode [out] start node of the range
* @param aStartOffset [out] start offset of the range
* @param aEndNode [out] end node of the range
* @param aEndOffset [out] end offset of the range
* @param aRange [out] the range whose bounds to set
*/
nsresult HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
PRInt32 aEndHTOffset,
nsIDOMNode **aStartNode,
PRInt32 *aStartOffset,
nsIDOMNode **aEndNode,
PRInt32 *aEndOffset);
nsRange* aRange);
/**
* Return true if the used ARIA role (if any) allows the hypertext accessible
@ -355,7 +347,7 @@ protected:
// Helpers
nsresult GetDOMPointByFrameOffset(nsIFrame* aFrame, PRInt32 aOffset,
Accessible* aAccessible,
nsIDOMNode** aNode, PRInt32* aNodeOffset);
mozilla::a11y::DOMPoint* aPoint);
/**

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMDocument.h"
#include "nsPIDOMWindow.h"
using namespace mozilla::a11y;

Просмотреть файл

@ -43,9 +43,7 @@
#include "nsIDocument.h"
#include "nsEventListenerManager.h"
#include "nsIFrame.h"
#include "nsIHTMLDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISelectionPrivate.h"
#include "nsIServiceManager.h"
#include "nsPIDOMWindow.h"
#include "nsIWebBrowserChrome.h"

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsContentList.h"
#include "nsIAccessibleRelation.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIDOMHTMLFormElement.h"

Просмотреть файл

@ -30,7 +30,6 @@
#endif
#include "nsIMutableArray.h"
#include "nsIDOMDocument.h"
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "nsINameSpaceManager.h"

Просмотреть файл

@ -12,10 +12,31 @@
NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
HyperTextAccessible)
IMPL_IUNKNOWN_INHERITED2(HyperTextAccessibleWrap,
AccessibleWrap,
ia2AccessibleHypertext,
ia2AccessibleEditableText);
STDMETHODIMP
HyperTextAccessibleWrap::QueryInterface(REFIID aIID, void** aInstancePtr)
{
if (!aInstancePtr)
return E_FAIL;
*aInstancePtr = NULL;
if (IsTextRole()) {
if (aIID == IID_IAccessibleText)
*aInstancePtr =
static_cast<IAccessibleText*>(static_cast<ia2AccessibleText*>(this));
else if (aIID == IID_IAccessibleHypertext)
*aInstancePtr = static_cast<IAccessibleHypertext*>(this);
else if (aIID == IID_IAccessibleEditableText)
*aInstancePtr = static_cast<IAccessibleEditableText*>(this);
if (*aInstancePtr) {
AddRef();
return S_OK;
}
}
return AccessibleWrap::QueryInterface(aIID, aInstancePtr);
}
nsresult
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)

Просмотреть файл

@ -155,10 +155,15 @@ __try {
if (IsDefunct())
return E_FAIL;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
nsRefPtr<nsRange> range = new nsRange();
if (NS_FAILED(range->SetStart(mContent, aStartIndex)))
return E_FAIL;
if (NS_FAILED(range->SetEnd(mContent, aEndIndex)))
return E_FAIL;
nsresult rv =
nsCoreUtils::ScrollSubstringTo(GetFrame(), DOMNode, aStartIndex,
DOMNode, aEndIndex,
nsCoreUtils::ScrollSubstringTo(GetFrame(), range,
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
if (NS_FAILED(rv))
return E_FAIL;

Просмотреть файл

@ -13,25 +13,6 @@
#include "nsCOMPtr.h"
#include "nsString.h"
// IUnknown
STDMETHODIMP
ia2AccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleEditableText == iid) {
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryObject(this));
if (!editTextAcc)
return E_NOINTERFACE;
*ppv = static_cast<IAccessibleEditableText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleEditableText
STDMETHODIMP

Просмотреть файл

@ -17,9 +17,6 @@ class ia2AccessibleEditableText: public IAccessibleEditableText
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleEditableText
virtual HRESULT STDMETHODCALLTYPE copyText(
/* [in] */ long startOffset,

Просмотреть файл

@ -11,25 +11,6 @@
#include "HyperTextAccessibleWrap.h"
// IUnknown
STDMETHODIMP
ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsTextRole()) {
*ppv = static_cast<IAccessibleHypertext*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
return ia2AccessibleText::QueryInterface(iid, ppv);
}
// IAccessibleHypertext
STDMETHODIMP

Просмотреть файл

@ -18,9 +18,6 @@ class ia2AccessibleHypertext : public ia2AccessibleText,
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleText
FORWARD_IACCESSIBLETEXT(ia2AccessibleText)

Просмотреть файл

@ -14,26 +14,6 @@
#include "nsIPersistentProperties2.h"
// IUnknown
STDMETHODIMP
ia2AccessibleText::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleText == iid) {
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryObject(this));
if (!textAcc) {
return E_NOINTERFACE;
}
*ppv = static_cast<IAccessibleText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleText
STDMETHODIMP

Просмотреть файл

@ -17,9 +17,6 @@ class ia2AccessibleText: public IAccessibleText
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleText
virtual HRESULT STDMETHODCALLTYPE addSelection(
/* [in] */ long startOffset,

Просмотреть файл

@ -17,7 +17,6 @@
#include "Statistics.h"
#include "nsAttrName.h"
#include "nsIDocument.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMHTMLElement.h"
#include "nsIFrame.h"

Просмотреть файл

@ -13,6 +13,8 @@
#include "mozilla/Preferences.h"
#include "nsArrayUtils.h"
#include "nsIArray.h"
#include "nsIDocument.h"
#include "nsIDocShellTreeItem.h"
using namespace mozilla;

Просмотреть файл

@ -9,9 +9,11 @@
#define nsWinUtils_h_
#include "Accessible2.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsCOMPtr.h"
#include "nsIArray.h"
#include "nsIDocument.h"
class nsIArray;
class nsIContent;
const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";

Просмотреть файл

@ -9,11 +9,13 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = chrome components locales app
DIRS = chrome components locales
ifeq ($(OS_ARCH),WINNT)
DIRS += $(DEPTH)/xulrunner/tools/redit
endif
DIRS += app
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/testing/testsuite-targets.mk

Просмотреть файл

@ -334,6 +334,17 @@ nsBrowserAccess.prototype = {
}
};
// Listen for system messages and relay them to Gaia.
Services.obs.addObserver(function(aSubject, aTopic, aData) {
let msg = JSON.parse(aData);
let origin = Services.io.newURI(msg.manifest, null, null).prePath;
shell.sendEvent(shell.contentBrowser.contentWindow,
"mozChromeEvent", { type: "open-app",
url: msg.uri,
origin: origin,
manifest: msg.manifest } );
}, "system-messages-open-app", false);
(function Repl() {
if (!Services.prefs.getBoolPref('b2g.remote-js.enabled')) {
return;
@ -390,7 +401,7 @@ var CustomEventManager = {
handleEvent: function custevt_handleEvent(evt) {
let detail = evt.detail;
dump('XXX FIXME : Got a mozContentEvent: ' + detail.type);
dump('XXX FIXME : Got a mozContentEvent: ' + detail.type + "\n");
switch(detail.type) {
case 'desktop-notification-click':

Просмотреть файл

@ -1,23 +0,0 @@
#GONK_TOOLCHAIN_VERSION=0
#TOOLCHAIN_HOST=linux-x86
#export GONK_PRODUCT=generic
#gonk="/home/cjones/mozilla/gonk-toolchain-$GONK_TOOLCHAIN_VERSION"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-b2g
mk_add_options MOZ_MAKE_FLAGS="-j8"
ac_add_options --enable-application=b2g
ac_add_options --target=arm-android-eabi
ac_add_options --with-gonk="$gonk"
ac_add_options --with-gonk-toolchain-prefix="$gonk/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-eabi-4.4.3/bin/arm-eabi-"
ac_add_options --with-endian=little
ac_add_options --disable-elf-hack
ac_add_options --enable-debug-symbols
ac_add_options --enable-profiling
ac_add_options --with-ccache
ac_add_options --enable-marionette
# Enable dump() from JS.
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP

Просмотреть файл

@ -1,23 +0,0 @@
#GONK_TOOLCHAIN_VERSION=0
#TOOLCHAIN_HOST=linux-x86
#export GONK_PRODUCT=generic
#gonk="/home/cjones/mozilla/gonk-toolchain-$GONK_TOOLCHAIN_VERSION"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-b2g
mk_add_options MOZ_MAKE_FLAGS="-j8"
ac_add_options --enable-application=b2g
ac_add_options --target=arm-android-eabi
ac_add_options --with-gonk="$gonk"
ac_add_options --with-gonk-toolchain-prefix="$gonk/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-eabi-4.4.3/bin/arm-eabi-"
ac_add_options --with-endian=little
ac_add_options --disable-elf-hack
ac_add_options --enable-debug-symbols
ac_add_options --enable-profiling
ac_add_options --with-ccache
ac_add_options --enable-marionette
# Enable dump() from JS.
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP

Просмотреть файл

@ -6,8 +6,6 @@ ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

Просмотреть файл

@ -37,3 +37,5 @@ fi
MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61}
MOZ_EXTENSION_MANAGER=1
ENABLE_MARIONETTE=1
MOZ_SYS_MSG=1

Просмотреть файл

@ -178,6 +178,7 @@
@BINPATH@/components/dom_mms.xpt
#endif
@BINPATH@/components/dom_browserelement.xpt
@BINPATH@/components/dom_messages.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_settings.xpt
@ -463,6 +464,10 @@
@BINPATH@/components/AppsService.js
@BINPATH@/components/AppsService.manifest
@BINPATH@/components/SystemMessageInternal.js
@BINPATH@/components/SystemMessageManager.js
@BINPATH@/components/SystemMessageManager.manifest
; Modules
@BINPATH@/modules/*

Просмотреть файл

@ -354,22 +354,17 @@
<label class="permissionLabel" id="permIndexedDBLabel"
value="&permIndexedDB;" control="indexedDBRadioGroup"/>
<hbox role="group" aria-labelledby="permIndexedDBLabel">
<checkbox id="indexedDBDef" command="cmd_indexedDBDef" label="&permUseDefault;"/>
<spacer flex="1"/>
<radiogroup id="indexedDBRadioGroup" orient="horizontal">
<!-- Ask and Allow are purposefully reversed here! -->
<radio id="indexedDB#1" command="cmd_indexedDBToggle" label="&permAskAlways;"/>
<radio id="indexedDB#0" command="cmd_indexedDBToggle" label="&permAllow;"/>
<radio id="indexedDB#2" command="cmd_indexedDBToggle" label="&permBlock;"/>
</radiogroup>
</hbox>
<hbox>
<checkbox id="indexedDBDef" command="cmd_indexedDBDef" label="&permAskAlways;"/>
<spacer flex="1"/>
<vbox pack="center">
<label id="indexedDBStatus" control="indexedDBClear" hidden="true"/>
<label id="indexedDBStatus" control="indexedDBClear"/>
</vbox>
<button id="indexedDBClear" label="&permClearStorage;" hidden="true"
<button id="indexedDBClear" label="&permClearStorage;"
accesskey="&permClearStorage.accesskey;" onclick="onIndexedDBClear();"/>
<radiogroup id="indexedDBRadioGroup" orient="horizontal">
<radio id="indexedDB#1" command="cmd_indexedDBToggle" label="&permAllow;"/>
<radio id="indexedDB#2" command="cmd_indexedDBToggle" label="&permBlock;"/>
</radiogroup>
</hbox>
</vbox>
<vbox class="permission" id="permPluginsRow">

Просмотреть файл

@ -51,7 +51,7 @@ var gPermObj = {
},
indexedDB: function getIndexedDBDefaultPermissions()
{
return UNKNOWN;
return BLOCK;
},
plugins: function getPluginsDefaultPermissions()
{
@ -149,6 +149,9 @@ function onCheckboxClick(aPartId)
var checkbox = document.getElementById(aPartId + "Def");
if (checkbox.checked) {
permissionManager.remove(gPermURI.host, aPartId);
if (aPartId == "indexedDB") {
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
}
command.setAttribute("disabled", "true");
var perm = gPermObj[aPartId]();
setRadioState(aPartId, perm);
@ -168,8 +171,7 @@ function onRadioClick(aPartId)
var id = radioGroup.selectedItem.id;
var permission = id.split('#')[1];
permissionManager.add(gPermURI, aPartId, permission);
if (aPartId == "indexedDB" &&
(permission == ALLOW || permission == BLOCK)) {
if (aPartId == "indexedDB" && permission == BLOCK) {
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
}
if (aPartId == "fullscreen" && permission == UNKNOWN) {
@ -205,6 +207,7 @@ function onIndexedDBClear()
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
.getService(nsIPermissionManager);
permissionManager.remove(gPermURI.host, "indexedDB");
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
initIndexedDBRow();
}

Просмотреть файл

@ -753,7 +753,7 @@
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
.copyStringToClipboard(val, document, Ci.nsIClipboard.kSelectionClipboard);
.copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard, document);
]]></handler>
</handlers>

Просмотреть файл

@ -5,7 +5,6 @@
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIImageLoadingContent.h"

Просмотреть файл

@ -763,8 +763,8 @@ SourceEditor.prototype = {
}
clipboardHelper.copyStringToClipboard(text,
this.parentElement.ownerDocument,
Ci.nsIClipboard.kSelectionClipboard);
Ci.nsIClipboard.kSelectionClipboard,
this.parentElement.ownerDocument);
},
/**

Просмотреть файл

@ -54,8 +54,8 @@ function editorLoaded()
let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboardHelper.copyStringToClipboard(expectedString,
testWin.document,
Ci.nsIClipboard.kSelectionClipboard);
Ci.nsIClipboard.kSelectionClipboard,
testWin.document);
};
let onCopy = function() {

Просмотреть файл

@ -96,8 +96,8 @@ function waitForSelection(aExpectedStringOrValidatorFn, aSetupFn,
let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboardHelper.copyStringToClipboard(preExpectedVal,
document,
Ci.nsIClipboard.kSelectionClipboard);
Ci.nsIClipboard.kSelectionClipboard,
document);
wait(function(aData) aData == preExpectedVal,
function() {

Просмотреть файл

@ -661,6 +661,9 @@ bin/libfreebl_32int64_3.so
#endif
#endif
@BINPATH@/crashreporter-override.ini
#ifdef MOZ_CRASHREPORTER_INJECTOR
@BINPATH@/breakpadinjector.dll
#endif
#endif
; [Extensions]

Просмотреть файл

@ -19,11 +19,8 @@ VISIBILITY_FLAGS =
# libstdc++-compat is not built yet.
STDCXX_COMPAT =
ifneq (WINNT,$(HOST_OS_ARCH))
HOST_PROGRAM = nsinstall$(HOST_BIN_SUFFIX)
ifeq (WINNT,$(HOST_OS_ARCH))
HOST_CSRCS = nsinstall_win.c
else
HOST_CSRCS = nsinstall.c pathsub.c
endif

Просмотреть файл

@ -156,6 +156,7 @@ LIBJPEG_TURBO_ARM_ASM = @LIBJPEG_TURBO_ARM_ASM@
NS_PRINTING = @NS_PRINTING@
MOZ_PDF_PRINTING = @MOZ_PDF_PRINTING@
MOZ_CRASHREPORTER = @MOZ_CRASHREPORTER@
MOZ_CRASHREPORTER_INJECTOR = @MOZ_CRASHREPORTER_INJECTOR@
MOZ_HELP_VIEWER = @MOZ_HELP_VIEWER@
MOC = @MOC@
RCC = @RCC@
@ -273,6 +274,8 @@ MOZ_NATIVE_NSS = @MOZ_NATIVE_NSS@
MOZ_B2G_RIL = @MOZ_B2G_RIL@
MOZ_B2G_BT = @MOZ_B2G_BT@
MOZ_SYS_MSG = @MOZ_SYS_MSG@
MOZ_ASAN = @MOZ_ASAN@
MOZ_CFLAGS_NSS = @MOZ_CFLAGS_NSS@
MOZ_NO_WLZDEFS = @MOZ_NO_WLZDEFS@

Просмотреть файл

@ -633,19 +633,34 @@ endif
PWD := $(CURDIR)
endif
NSINSTALL_PY := $(PYTHON) $(call core_abspath,$(topsrcdir)/config/nsinstall.py)
# For Pymake, wherever we use nsinstall.py we're also going to try to make it
# a native command where possible. Since native commands can't be used outside
# of single-line commands, we continue to provide INSTALL for general use.
# Single-line commands should be switched over to install_cmd.
NSINSTALL_NATIVECMD := %nsinstall nsinstall
ifdef NSINSTALL_BIN
NSINSTALL = $(NSINSTALL_BIN)
else
ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
else
ifeq ($(HOST_OS_ARCH),WINNT)
NSINSTALL = $(NSINSTALL_PY)
else
NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
endif # WINNT
endif # OS2
endif # NSINSTALL_BIN
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
INSTALL = $(NSINSTALL)
INSTALL = $(NSINSTALL) -t
ifdef .PYMAKE
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
endif # .PYMAKE
else
# This isn't laid out as conditional directives so that NSDISTMODE can be
@ -654,16 +669,17 @@ INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(fi
endif # WINNT/OS2
# The default for install_cmd is simply INSTALL
install_cmd ?= $(INSTALL) $(1)
# Use nsinstall in copy mode to install files on the system
SYSINSTALL = $(NSINSTALL) -t
# This isn't necessarily true, just here
sysinstall_cmd = install_cmd
# Directory nsinstall. Windows and OS/2 nsinstall can't recursively copy
# directories.
ifneq (,$(filter WINNT os2-emx,$(HOST_OS_ARCH)))
DIR_INSTALL = $(PYTHON) $(topsrcdir)/config/nsinstall.py
else
# Directory nsinstall.
DIR_INSTALL = $(INSTALL)
endif # WINNT/OS2
dir_install_cmd = install_cmd
#
# Localization build automation

Просмотреть файл

@ -46,13 +46,13 @@ xpidl-install-src-preqs=\
$(NULL)
xpidl-install-src: $(xpidl-install-src-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
xpidl-install-headers-preqs =\
$(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
$(call mkdir_deps,$(DIST)/include) \
$(NULL)
xpidl-install-headers: $(xpidl-install-headers-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
endif #} _xpidl-todo_

Просмотреть файл

@ -15,8 +15,9 @@ import os
import os.path
import sys
import shutil
import stat
def nsinstall(argv):
def _nsinstall_internal(argv):
usage = "usage: %prog [options] arg1 [arg2 ...] target-directory"
p = OptionParser(usage=usage)
@ -61,36 +62,47 @@ def nsinstall(argv):
return 1
# just create one directory?
if options.D:
if len(args) != 1:
def maybe_create_dir(dir, mode, try_again):
if os.path.exists(dir):
if not os.path.isdir(dir):
print >> sys.stderr, ('nsinstall: %s is not a directory' % dir)
return 1
if mode:
os.chmod(dir, mode)
return 0
try:
if mode:
os.makedirs(dir, mode)
else:
os.makedirs(dir)
except Exception, e:
# We might have hit EEXIST due to a race condition (see bug 463411) -- try again once
if try_again:
return maybe_create_dir(dir, mode, False)
print >> sys.stderr, ("nsinstall: failed to create directory %s: %s" % (dir, e))
return 1
if os.path.exists(args[0]):
if not os.path.isdir(args[0]):
sys.stderr.write('nsinstall: ' + args[0] + ' is not a directory\n')
sys.exit(1)
if options.m:
os.chmod(args[0], options.m)
sys.exit()
if options.m:
os.makedirs(args[0], options.m)
else:
os.makedirs(args[0])
return 0
return 0
if options.X:
options.X = [os.path.abspath(p) for p in options.X]
if options.D:
return maybe_create_dir(args[0], options.m, True)
# nsinstall arg1 [...] directory
if len(args) < 2:
p.error('not enough arguments')
def copy_all_entries(entries, target):
for e in entries:
if options.X and os.path.abspath(e) in options.X:
e = os.path.abspath(e)
if options.X and e in options.X:
continue
dest = os.path.join(target,
os.path.basename(os.path.normpath(e)))
dest = os.path.join(target, os.path.basename(e))
dest = os.path.abspath(dest)
handleTarget(e, dest)
if options.m:
os.chmod(dest, options.m)
@ -112,19 +124,57 @@ def nsinstall(argv):
# options.t is not relevant for directories
if options.m:
os.chmod(targetpath, options.m)
elif options.t:
shutil.copy2(srcpath, targetpath)
else:
shutil.copy(srcpath, targetpath)
if os.path.exists(targetpath):
# On Windows, read-only files can't be deleted
os.chmod(targetpath, stat.S_IWUSR)
os.remove(targetpath)
if options.t:
shutil.copy2(srcpath, targetpath)
else:
shutil.copy(srcpath, targetpath)
# the last argument is the target directory
target = args.pop()
# ensure target directory
if not os.path.isdir(target):
os.makedirs(target)
# ensure target directory (importantly, we do not apply a mode to the directory
# because we want to copy files into it and the mode might be read-only)
rv = maybe_create_dir(target, None, True)
if rv != 0:
return rv
copy_all_entries(args, target)
return 0
# nsinstall as a native command is always UTF-8
def nsinstall(argv):
return _nsinstall_internal([unicode(arg, "utf-8") for arg in argv])
if __name__ == '__main__':
sys.exit(nsinstall(sys.argv[1:]))
# sys.argv corrupts characters outside the system code page on Windows
# <http://bugs.python.org/issue2128>. Use ctypes instead. This is also
# useful because switching to Unicode strings makes python use the wide
# Windows APIs, which is what we want here since the wide APIs normally do a
# better job at handling long paths and such.
if sys.platform == "win32":
import ctypes
from ctypes import wintypes
GetCommandLine = ctypes.windll.kernel32.GetCommandLineW
GetCommandLine.argtypes = []
GetCommandLine.restype = wintypes.LPWSTR
CommandLineToArgv = ctypes.windll.shell32.CommandLineToArgvW
CommandLineToArgv.argtypes = [wintypes.LPWSTR, ctypes.POINTER(ctypes.c_int)]
CommandLineToArgv.restype = ctypes.POINTER(wintypes.LPWSTR)
argc = ctypes.c_int(0)
argv_arr = CommandLineToArgv(GetCommandLine(), ctypes.byref(argc))
# The first argv will be "python", the second will be the .py file
argv = argv_arr[1:argc.value]
else:
# For consistency, do it on Unix as well
if sys.stdin.encoding is not None:
argv = [unicode(arg, sys.stdin.encoding) for arg in sys.argv]
else:
argv = [unicode(arg) for arg in sys.argv]
sys.exit(_nsinstall_internal(argv[1:]))

Просмотреть файл

@ -1,747 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* The nsinstall command for Win32
*
* Our gmake makefiles use the nsinstall command to create the
* object directories or installing headers and libs. This code was originally
* taken from shmsdos.c
*/
#include <direct.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <windows.h>
#pragma hdrstop
/*
* sh_FileFcn --
*
* A function that operates on a file. The pathname is either
* absolute or relative to the current directory, and contains
* no wildcard characters such as * and ?. Additional arguments
* can be passed to the function via the arg pointer.
*/
typedef BOOL (*sh_FileFcn)(
wchar_t *pathName,
WIN32_FIND_DATA *fileData,
void *arg);
static int shellCp (wchar_t **pArgv);
static int shellNsinstall (wchar_t **pArgv);
static int shellMkdir (wchar_t **pArgv);
static BOOL sh_EnumerateFiles(const wchar_t *pattern, const wchar_t *where,
sh_FileFcn fileFcn, void *arg, int *nFiles);
static const char *sh_GetLastErrorMessage(void);
static BOOL sh_DoCopy(wchar_t *srcFileName, DWORD srcFileAttributes,
wchar_t *dstFileName, DWORD dstFileAttributes,
int force, int recursive);
#define LONGPATH_PREFIX L"\\\\?\\"
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
#define STR_LEN(a) (ARRAY_LEN(a) - 1)
#ifdef __MINGW32__
/* MingW currently does not implement a wide version of the
startup routines. Workaround is to implement something like
it ourselves. */
#include <shellapi.h>
int wmain(int argc, WCHAR **argv);
int main(int argc, char **argv)
{
int result;
wchar_t *commandLine = GetCommandLineW();
int argcw = 0;
wchar_t **_argvw = CommandLineToArgvW( commandLine, &argcw );
wchar_t *argvw[argcw + 1];
int i;
if (!_argvw)
return 127;
/* CommandLineToArgvW doesn't output the ending NULL so
we have to manually add it on */
for ( i = 0; i < argcw; i++ )
argvw[i] = _argvw[i];
argvw[argcw] = NULL;
result = wmain(argcw, argvw);
LocalFree(_argvw);
return result;
}
#endif /* __MINGW32__ */
/* changes all forward slashes in token to backslashes */
void changeForwardSlashesToBackSlashes ( wchar_t *arg )
{
if ( arg == NULL )
return;
while ( *arg ) {
if ( *arg == '/' )
*arg = '\\';
arg++;
}
}
int wmain(int argc, wchar_t *argv[ ])
{
return shellNsinstall ( argv + 1 );
}
static int
shellNsinstall (wchar_t **pArgv)
{
int retVal = 0; /* exit status */
int dirOnly = 0; /* 1 if and only if -D is specified */
wchar_t **pSrc;
wchar_t **pDst;
/*
* Process the command-line options. We ignore the
* options except for -D. Some options, such as -m,
* are followed by an argument. We need to skip the
* argument too.
*/
while ( *pArgv && **pArgv == '-' ) {
wchar_t c = (*pArgv)[1]; /* The char after '-' */
if ( c == 'D' ) {
dirOnly = 1;
} else if ( c == 'm' ) {
pArgv++; /* skip the next argument */
}
pArgv++;
}
if ( !dirOnly ) {
/* There are files to install. Get source files */
if ( *pArgv ) {
pSrc = pArgv++;
} else {
fprintf( stderr, "nsinstall: not enough arguments\n");
return 3;
}
}
/* Get to last token to find destination directory */
if ( *pArgv ) {
pDst = pArgv++;
if ( dirOnly && *pArgv ) {
fprintf( stderr, "nsinstall: too many arguments with -D\n");
return 3;
}
} else {
fprintf( stderr, "nsinstall: not enough arguments\n");
return 3;
}
while ( *pArgv )
pDst = pArgv++;
retVal = shellMkdir ( pDst );
if ( retVal )
return retVal;
if ( !dirOnly )
retVal = shellCp ( pSrc );
return retVal;
}
static int
shellMkdir (wchar_t **pArgv)
{
int retVal = 0; /* assume valid return */
wchar_t *arg;
wchar_t *pArg;
wchar_t path[_MAX_PATH];
wchar_t tmpPath[_MAX_PATH];
wchar_t *pTmpPath = tmpPath;
/* All the options are simply ignored in this implementation */
while ( *pArgv && **pArgv == '-' ) {
if ( (*pArgv)[1] == 'm' ) {
pArgv++; /* skip the next argument (mode) */
}
pArgv++;
}
while ( *pArgv ) {
arg = *pArgv;
changeForwardSlashesToBackSlashes ( arg );
pArg = arg;
pTmpPath = tmpPath;
while ( 1 ) {
/* create part of path */
while ( *pArg ) {
*pTmpPath++ = *pArg++;
if ( *pArg == '\\' )
break;
}
*pTmpPath = '\0';
/* check if directory already exists */
_wgetcwd ( path, _MAX_PATH );
if ( _wchdir ( tmpPath ) == -1 &&
_wmkdir ( tmpPath ) == -1 && // might have hit EEXIST
_wchdir ( tmpPath ) == -1) { // so try again
char buf[2048];
_snprintf(buf, 2048, "Could not create the directory: %S",
tmpPath);
perror ( buf );
retVal = 3;
break;
} else {
// get back to the cwd
_wchdir ( path );
}
if ( *pArg == '\0' ) /* complete path? */
break;
/* loop for next directory */
}
pArgv++;
}
return retVal;
}
static const char *
sh_GetLastErrorMessage()
{
static char buf[128];
FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* default language */
buf,
sizeof(buf),
NULL
);
return buf;
}
/*
* struct sh_FileData --
*
* A pointer to the sh_FileData structure is passed into sh_RecordFileData,
* which will fill in the fields.
*/
struct sh_FileData {
wchar_t pathName[_MAX_PATH];
DWORD dwFileAttributes;
};
/*
* sh_RecordFileData --
*
* Record the pathname and attributes of the file in
* the sh_FileData structure pointed to by arg.
*
* Always return TRUE (successful completion).
*
* This function is intended to be passed into sh_EnumerateFiles
* to see if a certain pattern expands to exactly one file/directory,
* and if so, record its pathname and attributes.
*/
static BOOL
sh_RecordFileData(wchar_t *pathName, WIN32_FIND_DATA *findData, void *arg)
{
struct sh_FileData *fData = (struct sh_FileData *) arg;
wcscpy(fData->pathName, pathName);
fData->dwFileAttributes = findData->dwFileAttributes;
return TRUE;
}
static BOOL
sh_DoCopy(wchar_t *srcFileName,
DWORD srcFileAttributes,
wchar_t *dstFileName,
DWORD dstFileAttributes,
int force,
int recursive
)
{
if (dstFileAttributes != 0xFFFFFFFF) {
if ((dstFileAttributes & FILE_ATTRIBUTE_READONLY) && force) {
dstFileAttributes &= ~FILE_ATTRIBUTE_READONLY;
SetFileAttributes(dstFileName, dstFileAttributes);
}
}
if (srcFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
fprintf(stderr, "nsinstall: %ls is a directory\n",
srcFileName);
return FALSE;
} else {
DWORD r;
wchar_t longSrc[1004] = LONGPATH_PREFIX;
wchar_t longDst[1004] = LONGPATH_PREFIX;
r = GetFullPathName(srcFileName, 1000, longSrc + STR_LEN(LONGPATH_PREFIX), NULL);
if (!r) {
fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
srcFileName, sh_GetLastErrorMessage());
return FALSE;
}
r = GetFullPathName(dstFileName, 1000, longDst + ARRAY_LEN(LONGPATH_PREFIX) - 1, NULL);
if (!r) {
fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
dstFileName, sh_GetLastErrorMessage());
return FALSE;
}
if (!CopyFile(longSrc, longDst, FALSE)) {
fprintf(stderr, "nsinstall: cannot copy %ls to %ls: %s\n",
srcFileName, dstFileName, sh_GetLastErrorMessage());
return FALSE;
}
}
return TRUE;
}
/*
* struct sh_CpCmdArg --
*
* A pointer to the sh_CpCmdArg structure is passed into sh_CpFileCmd.
* The sh_CpCmdArg contains information about the cp command, and
* provide a buffer for constructing the destination file name.
*/
struct sh_CpCmdArg {
int force; /* -f option, ok to overwrite an existing
* read-only destination file */
int recursive; /* -r or -R option, recursively copy
* directories. Note: this field is not used
* by nsinstall and should always be 0. */
wchar_t *dstFileName; /* a buffer for constructing the destination
* file name */
wchar_t *dstFileNameMarker; /* points to where in the dstFileName buffer
* we should write the file component of the
* destination file */
};
/*
* sh_CpFileCmd --
*
* Copy a file to the destination directory
*
* This function is intended to be passed into sh_EnumerateFiles to
* copy all the files specified by the pattern to the destination
* directory.
*
* Return TRUE if the file is successfully copied, and FALSE otherwise.
*/
static BOOL
sh_CpFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData, void *cpArg)
{
BOOL retVal = TRUE;
struct sh_CpCmdArg *arg = (struct sh_CpCmdArg *) cpArg;
wcscpy(arg->dstFileNameMarker, findData->cFileName);
return sh_DoCopy(pathName, findData->dwFileAttributes,
arg->dstFileName, GetFileAttributes(arg->dstFileName),
arg->force, arg->recursive);
}
static int
shellCp (wchar_t **pArgv)
{
int retVal = 0;
wchar_t **pSrc;
wchar_t **pDst;
struct sh_CpCmdArg arg;
struct sh_FileData dstData;
int dstIsDir = 0;
int n;
arg.force = 0;
arg.recursive = 0;
arg.dstFileName = dstData.pathName;
arg.dstFileNameMarker = 0;
while (*pArgv && **pArgv == '-') {
wchar_t *p = *pArgv;
while (*(++p)) {
if (*p == 'f') {
arg.force = 1;
}
}
pArgv++;
}
/* the first source file */
if (*pArgv) {
pSrc = pArgv++;
} else {
fprintf(stderr, "nsinstall: not enough arguments\n");
return 3;
}
/* get to the last token to find destination */
if (*pArgv) {
pDst = pArgv++;
} else {
fprintf(stderr, "nsinstall: not enough arguments\n");
return 3;
}
while (*pArgv) {
pDst = pArgv++;
}
/*
* The destination pattern must unambiguously expand to exactly
* one file or directory.
*/
changeForwardSlashesToBackSlashes(*pDst);
sh_EnumerateFiles(*pDst, *pDst, sh_RecordFileData, &dstData, &n);
assert(n >= 0);
if (n == 1) {
/*
* Is the destination a file or directory?
*/
if (dstData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
dstIsDir = 1;
}
} else if (n > 1) {
fprintf(stderr, "nsinstall: %ls: ambiguous destination file "
"or directory\n", *pDst);
return 3;
} else {
/*
* n == 0, meaning that destination file or directory does
* not exist. In this case the destination file directory
* name must be fully specified.
*/
wchar_t *p;
for (p = *pDst; *p; p++) {
if (*p == '*' || *p == '?') {
fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
*pDst);
return 3;
}
}
/*
* Do not include the trailing \, if any, unless it is a root
* directory (\ or X:\).
*/
if (p > *pDst && p[-1] == '\\' && p != *pDst + 1 && p[-2] != ':') {
p[-1] = '\0';
}
wcscpy(dstData.pathName, *pDst);
dstData.dwFileAttributes = 0xFFFFFFFF;
}
/*
* If there are two or more source files, the destination has
* to be a directory.
*/
if (pDst - pSrc > 1 && !dstIsDir) {
fprintf(stderr, "nsinstall: cannot copy more than"
" one file to the same destination file\n");
return 3;
}
if (dstIsDir) {
arg.dstFileNameMarker = arg.dstFileName + wcslen(arg.dstFileName);
/*
* Now arg.dstFileNameMarker is pointing to the null byte at the
* end of string. We want to make sure that there is a \ at the
* end of string, and arg.dstFileNameMarker should point right
* after that \.
*/
if (arg.dstFileNameMarker[-1] != '\\') {
*(arg.dstFileNameMarker++) = '\\';
}
}
if (!dstIsDir) {
struct sh_FileData srcData;
assert(pDst - pSrc == 1);
changeForwardSlashesToBackSlashes(*pSrc);
sh_EnumerateFiles(*pSrc, *pSrc, sh_RecordFileData, &srcData, &n);
if (n == 0) {
fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
*pSrc);
retVal = 3;
} else if (n > 1) {
fprintf(stderr, "nsinstall: cannot copy more than one file or "
"directory to the same destination\n");
retVal = 3;
} else {
assert(n == 1);
if (sh_DoCopy(srcData.pathName, srcData.dwFileAttributes,
dstData.pathName, dstData.dwFileAttributes,
arg.force, arg.recursive) == FALSE) {
retVal = 3;
}
}
return retVal;
}
for ( ; *pSrc != *pDst; pSrc++) {
BOOL rv;
changeForwardSlashesToBackSlashes(*pSrc);
rv = sh_EnumerateFiles(*pSrc, *pSrc, sh_CpFileCmd, &arg, &n);
if (rv == FALSE) {
retVal = 3;
} else {
if (n == 0) {
fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
*pSrc);
retVal = 3;
}
}
}
return retVal;
}
/*
* sh_EnumerateFiles --
*
* Enumerate all the files in the specified pattern, which is a pathname
* containing possibly wildcard characters such as * and ?. fileFcn
* is called on each file, passing the expanded file name, a pointer
* to the file's WIN32_FILE_DATA, and the arg pointer.
*
* It is assumed that there are no wildcard characters before the
* character pointed to by 'where'.
*
* On return, *nFiles stores the number of files enumerated. *nFiles is
* set to this number whether sh_EnumerateFiles or 'fileFcn' succeeds
* or not.
*
* Return TRUE if the files are successfully enumerated and all
* 'fileFcn' invocations succeeded. Return FALSE if something went
* wrong.
*/
static BOOL sh_EnumerateFiles(
const wchar_t *pattern,
const wchar_t *where,
sh_FileFcn fileFcn,
void *arg,
int *nFiles
)
{
WIN32_FIND_DATA fileData;
HANDLE hSearch;
const wchar_t *src;
wchar_t *dst;
wchar_t fileName[_MAX_PATH];
wchar_t *fileNameMarker = fileName;
wchar_t *oldFileNameMarker;
BOOL hasWildcard = FALSE;
BOOL retVal = TRUE;
BOOL patternEndsInDotStar = FALSE;
BOOL patternEndsInDot = FALSE; /* a special case of
* patternEndsInDotStar */
int numDotsInPattern;
int len;
/*
* Windows expands patterns ending in ".", ".*", ".**", etc.
* differently from the glob expansion on Unix. For example,
* both "foo." and "foo.*" match "foo", and "*.*" matches
* everything, including filenames with no dots. So we need
* to throw away extra files returned by the FindNextFile()
* function. We require that a matched filename have at least
* the number of dots in the pattern.
*/
len = wcslen(pattern);
if (len >= 2) {
/* Start from the end of pattern and go backward */
const wchar_t *p = &pattern[len - 1];
/* We can have zero or more *'s */
while (p >= pattern && *p == '*') {
p--;
}
if (p >= pattern && *p == '.') {
patternEndsInDotStar = TRUE;
if (p == &pattern[len - 1]) {
patternEndsInDot = TRUE;
}
p--;
numDotsInPattern = 1;
while (p >= pattern && *p != '\\') {
if (*p == '.') {
numDotsInPattern++;
}
p--;
}
}
}
*nFiles = 0;
/*
* Copy pattern to fileName, but only up to and not including
* the first \ after the first wildcard letter.
*
* Make fileNameMarker point to one of the following:
* - the start of fileName, if fileName does not contain any \.
* - right after the \ before the first wildcard letter, if there is
* a wildcard character.
* - right after the last \, if there is no wildcard character.
*/
dst = fileName;
src = pattern;
while (src < where) {
if (*src == '\\') {
oldFileNameMarker = fileNameMarker;
fileNameMarker = dst + 1;
}
*(dst++) = *(src++);
}
while (*src && *src != '*' && *src != '?') {
if (*src == '\\') {
oldFileNameMarker = fileNameMarker;
fileNameMarker = dst + 1;
}
*(dst++) = *(src++);
}
if (*src) {
/*
* Must have seen the first wildcard letter
*/
hasWildcard = TRUE;
while (*src && *src != '\\') {
*(dst++) = *(src++);
}
}
/* Now src points to either null or \ */
assert(*src == '\0' || *src == '\\');
assert(hasWildcard || *src == '\0');
*dst = '\0';
/*
* If the pattern does not contain any wildcard characters, then
* we don't need to go the FindFirstFile route.
*/
if (!hasWildcard) {
/*
* See if it is the root directory, \, or X:\.
*/
assert(!wcscmp(fileName, pattern));
assert(wcslen(fileName) >= 1);
if (dst[-1] == '\\' && (dst == fileName + 1 || dst[-2] == ':')) {
fileData.cFileName[0] = '\0';
} else {
/*
* Do not include the trailing \, if any
*/
if (dst[-1] == '\\') {
assert(*fileNameMarker == '\0');
dst[-1] = '\0';
fileNameMarker = oldFileNameMarker;
}
wcscpy(fileData.cFileName, fileNameMarker);
}
fileData.dwFileAttributes = GetFileAttributes(fileName);
if (fileData.dwFileAttributes == 0xFFFFFFFF) {
return TRUE;
}
*nFiles = 1;
return (*fileFcn)(fileName, &fileData, arg);
}
hSearch = FindFirstFile(fileName, &fileData);
if (hSearch == INVALID_HANDLE_VALUE) {
return retVal;
}
do {
if (!wcscmp(fileData.cFileName, L".")
|| !wcscmp(fileData.cFileName, L"..")) {
/*
* Skip over . and ..
*/
continue;
}
if (patternEndsInDotStar) {
int nDots = 0;
wchar_t *p = fileData.cFileName;
while (*p) {
if (*p == '.') {
nDots++;
}
p++;
}
/* Now p points to the null byte at the end of file name */
if (patternEndsInDot && (p == fileData.cFileName
|| p[-1] != '.')) {
/*
* File name does not end in dot. Skip this file.
* Note: windows file name probably cannot end in dot,
* but we do this check anyway.
*/
continue;
}
if (nDots < numDotsInPattern) {
/*
* Not enough dots in file name. Must be an extra
* file in matching .* pattern. Skip this file.
*/
continue;
}
}
wcscpy(fileNameMarker, fileData.cFileName);
if (*src && *(src + 1)) {
/*
* More to go. Recurse.
*/
int n;
assert(*src == '\\');
where = fileName + wcslen(fileName);
wcscat(fileName, src);
sh_EnumerateFiles(fileName, where, fileFcn, arg, &n);
*nFiles += n;
} else {
assert(wcschr(fileName, '*') == NULL);
assert(wcschr(fileName, '?') == NULL);
(*nFiles)++;
if ((*fileFcn)(fileName, &fileData, arg) == FALSE) {
retVal = FALSE;
}
}
} while (FindNextFile(hSearch, &fileData));
FindClose(hSearch);
return retVal;
}

Просмотреть файл

@ -1190,14 +1190,14 @@ endif
ifndef NO_DIST_INSTALL
ifneq (,$(EXPORTS))
export:: $(EXPORTS)
$(INSTALL) $(IFLAGS1) $^ $(DIST)/include
$(call install_cmd,$(IFLAGS1) $^ $(DIST)/include)
endif
endif # NO_DIST_INSTALL
define EXPORT_NAMESPACE_RULE
ifndef NO_DIST_INSTALL
export:: $(EXPORTS_$(namespace))
$(INSTALL) $(IFLAGS1) $$^ $(DIST)/include/$(namespace)
$(call install_cmd,$(IFLAGS1) $$^ $(DIST)/include/$(namespace))
endif # NO_DIST_INSTALL
endef
@ -1246,7 +1246,7 @@ $(FINAL_TARGET)/defaults/autoconfig::
ifndef NO_DIST_INSTALL
export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
$(INSTALL) $(IFLAGS1) $^
$(call install_cmd,$(IFLAGS1) $^)
endif
endif
@ -1312,7 +1312,7 @@ endif # XPIDL_MODULE.xpt != XPIDLSRCS
libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
ifndef NO_DIST_INSTALL
$(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
ifndef NO_INTERFACES_MANIFEST
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
@ -1340,7 +1340,7 @@ export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
ifneq ($(XPIDLSRCS),)
ifndef NO_DIST_INSTALL
export-idl:: $(XPIDLSRCS) $(IDL_DIR)
$(INSTALL) $(IFLAGS1) $^
$(call install_cmd,$(IFLAGS1) $^)
endif
endif
$(LOOP_OVER_PARALLEL_DIRS)
@ -1360,7 +1360,7 @@ endif
ifdef EXTRA_COMPONENTS
libs:: $(EXTRA_COMPONENTS)
ifndef NO_DIST_INSTALL
$(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
endif
endif
@ -1390,7 +1390,7 @@ endif
ifdef EXTRA_JS_MODULES
libs:: $(EXTRA_JS_MODULES)
ifndef NO_DIST_INSTALL
$(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
endif
endif
@ -1423,7 +1423,7 @@ GENERATED_DIRS += $(testmodulesdir)
libs:: $(TESTING_JS_MODULES)
ifndef NO_DIST_INSTALL
$(INSTALL) $(IFLAGS) $^ $(testmodulesdir)
$(call install_cmd,$(IFLAGS) $^ $(testmodulesdir))
endif
endif
@ -1437,7 +1437,7 @@ $(SDK_LIB_DIR)::
ifndef NO_DIST_INSTALL
libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
$(INSTALL) $(IFLAGS2) $^
$(call install_cmd,$(IFLAGS2) $^)
endif
endif # SDK_LIBRARY
@ -1448,7 +1448,7 @@ $(SDK_BIN_DIR)::
ifndef NO_DIST_INSTALL
libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
$(INSTALL) $(IFLAGS2) $^
$(call install_cmd,$(IFLAGS2) $^)
endif
endif # SDK_BINARY

Просмотреть файл

@ -4,8 +4,18 @@ import os, sys, os.path, time
from tempfile import mkdtemp
from shutil import rmtree
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from mozprocess import processhandler
from nsinstall import nsinstall
import nsinstall as nsinstall_module
NSINSTALL_PATH = nsinstall_module.__file__
# Run the non-ASCII tests on (a) Windows, or (b) any platform with
# sys.stdin.encoding set to UTF-8
import codecs
RUN_NON_ASCII_TESTS = (sys.platform == "win32" or
(sys.stdin.encoding is not None and
codecs.lookup(sys.stdin.encoding) == codecs.lookup("utf-8")))
class TestNsinstall(unittest.TestCase):
"""
@ -15,7 +25,13 @@ class TestNsinstall(unittest.TestCase):
self.tmpdir = mkdtemp()
def tearDown(self):
rmtree(self.tmpdir)
# Unicode strings means non-ASCII children can be deleted properly on
# Windows
if sys.stdin.encoding is None:
tmpdir = unicode(self.tmpdir)
else:
tmpdir = unicode(self.tmpdir, sys.stdin.encoding)
rmtree(tmpdir)
# utility methods for tests
def touch(self, file, dir=None):
@ -121,6 +137,36 @@ class TestNsinstall(unittest.TestCase):
self.assertEqual(nsinstall(["-d", testfile, destdir]), 0)
self.assert_(os.path.isdir(os.path.join(destdir, "testfile")))
if RUN_NON_ASCII_TESTS:
def test_nsinstall_non_ascii(self):
"Test that nsinstall handles non-ASCII files"
filename = u"\u2325\u3452\u2415\u5081"
testfile = self.touch(filename)
testdir = self.mkdirs(u"\u4241\u1D04\u1414")
self.assertEqual(nsinstall([testfile.encode("utf-8"),
testdir.encode("utf-8")]), 0)
destfile = os.path.join(testdir, filename)
self.assert_(os.path.isfile(destfile))
def test_nsinstall_non_ascii_subprocess(self):
"Test that nsinstall as a subprocess handles non-ASCII files"
filename = u"\u2325\u3452\u2415\u5081"
testfile = self.touch(filename)
testdir = self.mkdirs(u"\u4241\u1D04\u1414")
# We don't use subprocess because it can't handle Unicode on
# Windows <http://bugs.python.org/issue1759845>. mozprocess calls
# CreateProcessW directly so it's perfect.
p = processhandler.ProcessHandlerMixin([sys.executable,
NSINSTALL_PATH,
testfile, testdir])
p.run()
rv = p.waitForFinish()
self.assertEqual(rv, 0)
destfile = os.path.join(testdir, filename)
self.assert_(os.path.isfile(destfile))
#TODO: implement -R, -l, -L and test them!
if __name__ == '__main__':

Просмотреть файл

@ -5890,6 +5890,11 @@ if test -n "$MOZ_CRASHREPORTER"; then
if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
fi
if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
MOZ_CRASHREPORTER_INJECTOR=1
AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
fi
fi
MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
@ -7437,6 +7442,12 @@ if test -n "$MOZ_B2G_BT"; then
fi
AC_SUBST(MOZ_B2G_BT)
dnl ========================================================
dnl = Enable Support for System Messages API
dnl ========================================================
AC_SUBST(MOZ_SYS_MSG)
dnl ========================================================
dnl = Support for demangling undefined symbols
dnl ========================================================
@ -8353,6 +8364,7 @@ AC_SUBST(MOZ_SPELLCHECK)
AC_SUBST(MOZ_JAVA_COMPOSITOR)
AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
AC_SUBST(MOZ_CRASHREPORTER)
AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR)

Просмотреть файл

@ -17,7 +17,6 @@
class nsAString;
class nsIContent;
class nsIDocument;
class nsINodeInfo;
class imgIRequest;
class nsNodeInfoManager;

Просмотреть файл

@ -125,14 +125,16 @@ NS_CP_ContentTypeName(PRUint32 contentType)
return NS_ERROR_FAILURE; \
\
return policy-> action (contentType, contentLocation, requestOrigin, \
context, mimeType, extra, decision); \
context, mimeType, extra, originPrincipal, \
decision); \
PR_END_MACRO
/* Passes on parameters from its "caller"'s context. */
#define CHECK_CONTENT_POLICY_WITH_SERVICE(action, _policy) \
PR_BEGIN_MACRO \
return _policy-> action (contentType, contentLocation, requestOrigin, \
context, mimeType, extra, decision); \
context, mimeType, extra, originPrincipal, \
decision); \
PR_END_MACRO
/**

Просмотреть файл

@ -31,25 +31,16 @@ static fp_except_t oldmask = fpsetmask(~allmask);
#include "nsAString.h"
#include "nsIStatefulFrame.h"
#include "nsINodeInfo.h"
#include "nsNodeInfoManager.h"
#include "nsContentList.h"
#include "nsDOMClassInfoID.h"
#include "nsIXPCScriptable.h"
#include "nsDataHashtable.h"
#include "nsIScriptRuntime.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMEvent.h"
#include "nsTArray.h"
#include "nsTextFragment.h"
#include "nsReadableUtils.h"
#include "nsINode.h"
#include "nsHashtable.h"
#include "nsIDOMNode.h"
#include "nsHtml5StringParser.h"
#include "nsIParser.h"
#include "nsIDocument.h"
#include "nsIFragmentContentSink.h"
#include "nsContentSink.h"
#include "nsMathUtils.h"
#include "nsThreadUtils.h"
@ -70,9 +61,13 @@ class nsIDocument;
class nsIDocumentObserver;
class nsIDocShell;
class nsINameSpaceManager;
class nsIFragmentContentSink;
class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
class nsTextFragment;
class nsIJSContextStack;
class nsIThreadJSContextStack;
class nsIParser;
class nsIParserService;
class nsIIOService;
class nsIURI;
@ -95,6 +90,7 @@ class nsEventListenerManager;
class nsIScriptContext;
class nsIRunnable;
class nsIInterfaceRequestor;
class nsINodeInfo;
template<class E> class nsCOMArray;
template<class K, class V> class nsRefPtrHashtable;
struct JSRuntime;

Просмотреть файл

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIPrincipal.idl"
interface nsIURI;
interface nsIDOMNode;
@ -18,7 +19,7 @@ interface nsIDOMNode;
* by launching a dialog to prompt the user for something).
*/
[scriptable,uuid(344f9cb0-9a17-44c5-ab96-ee707884266c)]
[scriptable,uuid(e590e74f-bac7-4876-8c58-54dde92befb2)]
interface nsIContentPolicy : nsISupports
{
const unsigned long TYPE_OTHER = 1;
@ -209,7 +210,8 @@ interface nsIContentPolicy : nsISupports
in nsIURI aRequestOrigin,
in nsISupports aContext,
in ACString aMimeTypeGuess,
in nsISupports aExtra);
in nsISupports aExtra,
[optional] in nsIPrincipal aRequestPrincipal);
/**
* Should the resource be processed?
@ -251,6 +253,7 @@ interface nsIContentPolicy : nsISupports
in nsIURI aRequestOrigin,
in nsISupports aContext,
in ACString aMimeType,
in nsISupports aExtra);
in nsISupports aExtra,
[optional] in nsIPrincipal aRequestPrincipal);
};

Просмотреть файл

@ -11,8 +11,6 @@
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsIURI.h"
#include "nsWeakPtr.h"
#include "nsIWeakReferenceUtils.h"
#include "nsILoadGroup.h"
#include "nsCRT.h"
#include "mozFlushType.h"
@ -22,7 +20,6 @@
#include "nsTHashtable.h"
#include "nsHashKeys.h"
#include "nsNodeInfoManager.h"
#include "nsIStreamListener.h"
#include "nsIVariant.h"
#include "nsIObserver.h"
#include "nsGkAtoms.h"
@ -34,9 +31,12 @@
#include "nsIFrameRequestCallback.h"
#include "nsEventStates.h"
#include "nsIStructuredCloneContainer.h"
#include "nsIBFCacheEntry.h"
#include "nsILoadContext.h"
class nsIRequest;
class nsPIDOMWindow;
class nsIStreamListener;
class nsIBFCacheEntry;
class nsIContent;
class nsPresContext;
class nsIPresShell;

Просмотреть файл

@ -8,7 +8,6 @@
#include "nsISupports.h"
class nsIDocument;
class nsICSSLoaderObserver;
class nsIURI;

Просмотреть файл

@ -10,7 +10,6 @@
#include "nsIURL.h"
#include "nsISizeOf.h"
#include "nsContentUtils.h"
#include "nsEscape.h"
#include "nsGkAtoms.h"
#include "nsString.h"

Просмотреть файл

@ -13,8 +13,6 @@
#include "nsUnicharUtils.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h"
#include "nsIHTMLDocument.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
#include "prprf.h"

Просмотреть файл

@ -23,7 +23,6 @@
typedef PRUptrdiff PtrBits;
class nsAString;
class nsIAtom;
class nsIDocument;
template<class E, class A> class nsTArray;
struct nsTArrayDefaultAllocator;

Просмотреть файл

@ -8,7 +8,6 @@
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsServiceManagerUtils.h"
#include "nsIDOMDocument.h"
#include "nsIContentViewer.h"
#include "nsIDocument.h"
#include "nsIWindowMediator.h"

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsIURI.h"
#include "nsIPrincipal.h"
#include "nsIObserver.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsCSPService.h"
#include "nsIContentSecurityPolicy.h"
@ -58,6 +57,7 @@ CSPService::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestContext,
const nsACString &aMimeTypeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
if (!aContentLocation)
@ -124,6 +124,7 @@ CSPService::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestContext,
const nsACString &aMimeTypeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
if (!aContentLocation)

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsGenericDOMDataNode.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsGenericElement.h" // DOMCI_NODE_DATA
class nsCommentNode : public nsGenericDOMDataNode,

Просмотреть файл

@ -15,7 +15,6 @@
class nsIDOMNode;
class nsIDOMWindow;
class nsIDOMDocument;
class nsIDOMDragEvent;
class nsISelection;
class nsITransferable;

Просмотреть файл

@ -41,7 +41,6 @@ typedef bool (*nsContentListMatchFunc)(nsIContent* aContent,
typedef void (*nsContentListDestroyFunc)(void* aData);
class nsIDocument;
namespace mozilla {
namespace dom {
class Element;

Просмотреть файл

@ -76,6 +76,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
//sanity-check passed-through parameters
@ -122,7 +123,8 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
/* check the appropriate policy */
rv = (entries[i]->*policyMethod)(contentType, contentLocation,
requestingLocation, requestingContext,
mimeType, extra, decision);
mimeType, extra, requestPrincipal,
decision);
if (NS_SUCCEEDED(rv) && NS_CP_REJECTED(*decision)) {
/* policy says no, no point continuing to check */
@ -177,13 +179,15 @@ nsContentPolicy::ShouldLoad(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
// ShouldProcess does not need a content location, but we do
NS_PRECONDITION(contentLocation, "Must provide request location");
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldLoad, contentType,
contentLocation, requestingLocation,
requestingContext, mimeType, extra, decision);
requestingContext, mimeType, extra,
requestPrincipal, decision);
LOG_CHECK("ShouldLoad");
return rv;
@ -196,11 +200,13 @@ nsContentPolicy::ShouldProcess(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldProcess, contentType,
contentLocation, requestingLocation,
requestingContext, mimeType, extra, decision);
requestingContext, mimeType, extra,
requestPrincipal, decision);
LOG_CHECK("ShouldProcess");
return rv;

Просмотреть файл

@ -31,7 +31,8 @@ class nsContentPolicy : public nsIContentPolicy
NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
ShouldProcess,
(PRUint32, nsIURI*, nsIURI*, nsISupports*,
const nsACString &, nsISupports*, PRInt16*));
const nsACString &, nsISupports*, nsIPrincipal*,
PRInt16*));
//Helper method that applies policyMethod across all policies in mPolicies
// with the given parameters
@ -39,6 +40,7 @@ class nsContentPolicy : public nsIContentPolicy
nsIURI *aURI, nsIURI *origURI,
nsISupports *requestingContext,
const nsACString &mimeGuess, nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision);
};

Просмотреть файл

@ -14,9 +14,7 @@
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "mozilla/css/Loader.h"
#include "nsStyleConsts.h"
#include "nsStyleLinkElement.h"
#include "nsINodeInfo.h"
#include "nsIDocShell.h"
#include "nsILoadContext.h"
#include "nsIDocShellTreeItem.h"
@ -25,49 +23,30 @@
#include "nsNetUtil.h"
#include "nsIHttpChannel.h"
#include "nsIContent.h"
#include "nsIScriptElement.h"
#include "nsContentErrors.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIViewManager.h"
#include "nsIContentViewer.h"
#include "nsIAtom.h"
#include "nsGkAtoms.h"
#include "nsIDOMWindow.h"
#include "nsIPrincipal.h"
#include "nsIScriptGlobalObject.h"
#include "nsNetCID.h"
#include "nsIOfflineCacheUpdate.h"
#include "nsIApplicationCache.h"
#include "nsIApplicationCacheContainer.h"
#include "nsIApplicationCacheChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsIDOMLoadStatus.h"
#include "nsICookieService.h"
#include "nsIPrompt.h"
#include "nsServiceManagerUtils.h"
#include "nsContentUtils.h"
#include "nsCRT.h"
#include "nsEscape.h"
#include "nsWeakReference.h"
#include "nsUnicharUtils.h"
#include "nsNodeInfoManager.h"
#include "nsIAppShell.h"
#include "nsIWidget.h"
#include "nsWidgetsCID.h"
#include "nsIRequest.h"
#include "nsNodeUtils.h"
#include "nsIDOMNode.h"
#include "nsThreadUtils.h"
#include "nsPIDOMWindow.h"
#include "mozAutoDocUpdate.h"
#include "nsIWebNavigation.h"
#include "nsIDocumentLoader.h"
#include "nsICachingChannel.h"
#include "nsICacheEntryDescriptor.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLDNSPrefetch.h"
#include "nsISupportsPrimitives.h"
#include "nsIObserverService.h"
#include "mozilla/Preferences.h"
#include "nsParserConstants.h"

Просмотреть файл

@ -16,22 +16,15 @@
#include "nsICSSLoaderObserver.h"
#include "nsWeakReference.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsString.h"
#include "nsAutoPtr.h"
#include "nsGkAtoms.h"
#include "nsTHashtable.h"
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsITimer.h"
#include "nsStubDocumentObserver.h"
#include "nsIParserService.h"
#include "nsIContentSink.h"
#include "prlog.h"
#include "nsIRequest.h"
#include "nsCycleCollectionParticipant.h"
#include "nsThreadUtils.h"
#include "nsIScriptElement.h"
class nsIDocument;
class nsIURI;

Просмотреть файл

@ -16,11 +16,8 @@
#include "nsCOMPtr.h"
#include "nsAString.h"
#include "nsPrintfCString.h"
#include "nsUnicharUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsDOMCID.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
@ -28,7 +25,6 @@
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsReadableUtils.h"
#include "nsIIdleService.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNodeList.h"
@ -37,7 +33,6 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h"
#include "nsDOMError.h"
#include "nsPIDOMWindow.h"
#include "nsIJSContextStack.h"
#include "nsIDocShell.h"
@ -46,21 +41,13 @@
#include "nsIParser.h"
#include "nsIFragmentContentSink.h"
#include "nsIContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsIXMLContentSink.h"
#include "nsHTMLParts.h"
#include "nsIServiceManager.h"
#include "nsIAttribute.h"
#include "nsContentList.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsGkAtoms.h"
#include "nsISupportsPrimitives.h"
#include "imgIDecoderObserver.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
@ -88,19 +75,14 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#include "nsIJSRuntimeService.h"
#include "nsIDOMDocumentXBL.h"
#include "nsBindingManager.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsXBLBinding.h"
#include "nsXBLPrototypeBinding.h"
#include "nsEscape.h"
#include "nsICharsetConverterManager.h"
#include "nsEventListenerManager.h"
#include "nsAttrName.h"
#include "nsIDOMUserDataHandler.h"
#include "nsContentCreatorFunctions.h"
#include "nsGUIEvent.h"
#include "nsMutationEvent.h"
#include "nsIMEStateManager.h"
#include "nsContentErrors.h"
@ -109,7 +91,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIDOMNSEvent.h"
#include "nsXULPopupManager.h"
#include "nsIPermissionManager.h"
#include "nsIContentPrefService.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsNullPrincipal.h"
#include "nsIRunnable.h"
@ -124,16 +105,11 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsCPrefetchService.h"
#include "nsIChromeRegistry.h"
#include "nsEventDispatcher.h"
#include "nsIMIMEHeaderParam.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIDOMDragEvent.h"
#include "nsDOMDataTransfer.h"
#include "nsHtml5Module.h"
#include "nsPresContext.h"
#include "nsLayoutStatics.h"
#include "nsLayoutUtils.h"
#include "nsFrameManager.h"
#include "BasicLayers.h"
#include "nsFocusManager.h"
#include "nsTextEditorState.h"
#include "nsIPluginHost.h"
@ -143,6 +119,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIDOMHTMLInputElement.h"
#include "nsParserConstants.h"
#include "nsIWebNavigation.h"
#include "nsTextFragment.h"
#include "mozilla/Selection.h"
#ifdef IBMBIDI
@ -167,7 +144,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsHTMLMediaElement.h"
#endif
#include "nsDOMTouchEvent.h"
#include "nsIScriptElement.h"
#include "nsIContentViewer.h"
#include "nsIObjectLoadingContent.h"
#include "nsCCUncollectableMarker.h"
@ -182,6 +158,8 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIEditor.h"
#include "nsIEditorDocShell.h"
#include "mozilla/Attributes.h"
#include "nsIParserService.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsWrapperCacheInlines.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsDOMAttribute.h"
#include "nsIDOMDocument.h"
#include "nsGenericElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsDOMError.h"

Просмотреть файл

@ -17,7 +17,6 @@
#include "nsIDOMNode.h"
class nsIAtom;
class nsIContent;
class nsDOMAttribute;
class nsINodeInfo;
class nsIDocument;

Просмотреть файл

@ -12,12 +12,9 @@
#include "nsIDOMNamedNodeMap.h"
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsDOMString.h"
#include "nsNodeInfoManager.h"
#include "nsIDocument.h"
#include "nsIXPConnect.h"
#include "nsIDOMDocument.h"
#include "xpcpublic.h"
#include "nsWrapperCacheInlines.h"

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsICharsetConverterManager.h"
#include "nsIConverterInputStream.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIFileStreams.h"
#include "nsIInputStream.h"
#include "nsIIPCSerializable.h"

Просмотреть файл

@ -10,7 +10,6 @@
#include "nsDOMLists.h"
#include "nsDOMError.h"
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "nsINode.h"
nsDOMStringList::nsDOMStringList()

Просмотреть файл

@ -7,13 +7,10 @@
#include "nsIDOMNode.h"
#include "nsDOMClassInfoID.h"
#include "nsIOutputStream.h"
#include "nsINode.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsIContentSerializer.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsContentCID.h"
#include "nsContentUtils.h"
#include "nsDOMError.h"

Просмотреть файл

@ -37,6 +37,7 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
@ -129,8 +130,10 @@ nsDataDocumentContentPolicy::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}

Просмотреть файл

@ -160,7 +160,6 @@
#include "nsHTMLCSSStyleSheet.h"
#include "mozilla/dom/Link.h"
#include "nsIHTMLDocument.h"
#include "nsXULAppAPI.h"
#include "nsDOMTouchEvent.h"

Просмотреть файл

@ -14,13 +14,9 @@
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsNodeInfoManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMAttr.h"
#include "nsDOMError.h"
#include "nsGkAtoms.h"
#include "nsDOMString.h"
#include "nsIDOMUserDataHandler.h"
#include "nsContentUtils.h"
class nsDocumentFragment : public nsGenericElement,

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsIDOMElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsINameSpaceManager.h"
#include "nsString.h"
#include "nsUnicharUtils.h"

Просмотреть файл

@ -10,12 +10,8 @@
*/
#include "nsNoDataProtocolContentPolicy.h"
#include "nsIDocument.h"
#include "nsINode.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsString.h"
#include "nsContentUtils.h"
#include "nsIProtocolHandler.h"
#include "nsIIOService.h"
#include "nsIExternalProtocolHandler.h"
@ -30,6 +26,7 @@ nsNoDataProtocolContentPolicy::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
@ -74,8 +71,10 @@ nsNoDataProtocolContentPolicy::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}

Просмотреть файл

@ -13,7 +13,7 @@
#include "nsIDOMRange.h"
#include "nsCOMPtr.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIContent.h"
#include "nsINode.h"
#include "nsIDOMNode.h"
#include "prmon.h"
#include "nsStubMutationObserver.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsEscape.h"
#include "nsXBLPrototypeBinding.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsCycleCollectionParticipant.h"

Просмотреть файл

@ -17,7 +17,7 @@
#include "nsWeakReference.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"

Просмотреть файл

@ -9,8 +9,7 @@
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsDOMError.h"
#include "nsIContent.h"
#include "nsINode.h"
#include "nsGkAtoms.h"

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsIDOMNodeFilter.h"
#include "nsDOMError.h"
#include "nsINode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsIDOMElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsINameSpaceManager.h"
#include "nsString.h"
#include "nsUnicharUtils.h"

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsIXMLHttpRequest.h"
#include "nsISupportsUtils.h"
#include "nsString.h"
#include "nsIDOMDocument.h"
#include "nsIURI.h"
#include "nsIHttpChannel.h"
#include "nsIDocument.h"

Просмотреть файл

@ -4,7 +4,6 @@
#include "TestHarness.h"
#include "nsIDOMDocument.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXMLHttpRequest.h"

Просмотреть файл

@ -12,13 +12,10 @@
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsHTMLCanvasElement.h"
#include "nsIPrincipal.h"
#include "nsINode.h"
#include "nsGfxCIID.h"

Просмотреть файл

@ -10,11 +10,9 @@
#include "gfxPattern.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsCSSParser.h"

Просмотреть файл

@ -39,6 +39,7 @@
#include "mozilla/Telemetry.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsTArray.h"
#include "nsDataHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsHashKeys.h"
#include "nsIDocShell.h"
@ -19,19 +18,15 @@
#include "nsIDOMWebGLRenderingContext.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsHTMLCanvasElement.h"
#include "nsWeakReference.h"
#include "nsIDOMHTMLElement.h"
#include "nsIMemoryReporter.h"
#include "nsIJSNativeInitializer.h"
#include "nsContentUtils.h"
#include "nsWrapperCache.h"
#include "nsIObserver.h"
#include "GLContextProvider.h"
#include "Layers.h"
#include "nsDataHashtable.h"
#include "mozilla/LinkedList.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/dom/ImageData.h"
@ -65,7 +60,6 @@
#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024 // Different from the spec, which sets it to 1 on page 164
#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Page 164
class nsIDocShell;
class nsIPropertyBag;
namespace mozilla {

Просмотреть файл

@ -15,19 +15,12 @@
#include "nsServiceManagerUtils.h"
#include "nsIVariant.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMDataContainerEvent.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#if 0
#include "nsIContentURIGrouper.h"
#include "nsIContentPrefService.h"
#endif
using namespace mozilla;
void

Просмотреть файл

@ -17,6 +17,7 @@
#include <algorithm>
#include "mozilla/Services.h"
#include "nsIObserverService.h"
using namespace mozilla;

Просмотреть файл

@ -16,7 +16,6 @@
#include "nsContentUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsICanvasRenderingContextInternal.h"

Просмотреть файл

@ -16,7 +16,6 @@
#include "nsContentUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsHTMLCanvasElement.h"
#include "nsSVGEffects.h"

Просмотреть файл

@ -10,8 +10,6 @@
#include "nsCOMPtr.h"
#include "nsEvent.h"
class nsIContent;
class nsIDocument;
class nsPresContext;
class nsIDOMEvent;
class nsIScriptGlobalObject;

Просмотреть файл

@ -9,8 +9,6 @@
#include "nsGUIEvent.h"
#include "nsIDOMNode.h"
#include "nsIAtom.h"
#include "nsIDOMEventTarget.h"
#include "nsIContent.h"
class nsMutationEvent : public nsEvent
{

Просмотреть файл

@ -5,7 +5,6 @@
#include "nsAsyncDOMEvent.h"
#include "nsIDOMEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEventTarget.h"
#include "nsContentUtils.h"
#include "nsEventDispatcher.h"

Просмотреть файл

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMClassInfoID.h"
#include "nsDOMBeforeUnloadEvent.h"
#include "nsContentUtils.h"
NS_IMPL_ADDREF_INHERITED(nsDOMBeforeUnloadEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMBeforeUnloadEvent, nsDOMEvent)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше