This commit is contained in:
Philipp von Weitershausen 2011-10-17 10:10:07 -07:00
Родитель 37eb32a9e6 f9c553b06f
Коммит d97a8b2f57
2035 изменённых файлов: 91695 добавлений и 64160 удалений

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

@ -38,6 +38,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsAccessible.h"
#include "nsAccessibleWrap.h"
@ -69,6 +71,7 @@
#include "nsMaiInterfaceDocument.h"
#include "nsMaiInterfaceImage.h"
using namespace mozilla;
using namespace mozilla::a11y;
nsAccessibleWrap::EAvailableAtkSignals nsAccessibleWrap::gAvailableAtkSignals =
@ -522,7 +525,7 @@ GetMaiAtkType(PRUint16 interfacesBits)
atkTypeName,
&tinfo, GTypeFlags(0));
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(atk_if_infos); index++) {
for (PRUint32 index = 0; index < ArrayLength(atk_if_infos); index++) {
if (interfacesBits & (1 << index)) {
g_type_add_interface_static(type,
GetAtkTypeForMai((MaiInterfaceType)index),
@ -963,7 +966,7 @@ refRelationSetCB(AtkObject *aAtkObj)
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
};
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationTypes); i++) {
for (PRUint32 i = 0; i < ArrayLength(relationTypes); i++) {
AtkRelationType atkType = static_cast<AtkRelationType>(relationTypes[i]);
AtkRelation* atkRelation =
atk_relation_set_get_relation_by_type(relation_set, atkType);

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

@ -210,8 +210,10 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
if (!mDocument->HasLoadState(nsDocAccessible::eTreeConstructed)) {
// If document is not bound to parent at this point then the document is not
// ready yet (process notifications later).
if (!mDocument->IsBoundToParent())
if (!mDocument->IsBoundToParent()) {
mObservingState = eRefreshObserving;
return;
}
#ifdef DEBUG_NOTIFICATIONS
printf("\ninitial tree created, document: %p, document node: %p\n",

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

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
@ -111,6 +113,7 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -654,7 +657,7 @@ nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{
if ( aRole >= NS_ARRAY_LENGTH(kRoleNames)) {
if ( aRole >= ArrayLength(kRoleNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
@ -785,10 +788,10 @@ NS_IMETHODIMP
nsAccessibilityService::GetStringEventType(PRUint32 aEventType,
nsAString& aString)
{
NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == NS_ARRAY_LENGTH(kEventTypeNames),
NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == ArrayLength(kEventTypeNames),
"nsIAccessibleEvent constants are out of sync to kEventTypeNames");
if (aEventType >= NS_ARRAY_LENGTH(kEventTypeNames)) {
if (aEventType >= ArrayLength(kEventTypeNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
@ -802,7 +805,7 @@ NS_IMETHODIMP
nsAccessibilityService::GetStringRelationType(PRUint32 aRelationType,
nsAString& aString)
{
if (aRelationType >= NS_ARRAY_LENGTH(kRelationTypeNames)) {
if (aRelationType >= ArrayLength(kRelationTypeNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}

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

@ -226,6 +226,10 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
printf("\nSelection changed, selection type: %s, notification %s\n",
(isNormalSelection ? "normal" : "spellcheck"),
(isIgnored ? "ignored" : "pending"));
} else {
bool isIgnored = !document || !document->IsContentLoaded();
printf("\nSelection changed, selection type: unknown, notification %s\n",
(isIgnored ? "ignored" : "pending"));
}
#endif

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

@ -77,7 +77,7 @@
#include "nsIXULDocument.h"
#endif
namespace dom = mozilla::dom;
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////

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

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#define CreateEvent CreateEventA
#include "nsIDOMDocument.h"
@ -83,7 +85,7 @@
#include "nsIXULWindow.h"
#endif
namespace dom = mozilla::dom;
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -255,7 +257,7 @@ nsresult nsRootAccessible::AddEventListeners()
if (nstarget) {
for (const char* const* e = docEvents,
* const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents);
* const* e_end = ArrayEnd(docEvents);
e < e_end; ++e) {
nsresult rv = nstarget->AddEventListener(NS_ConvertASCIItoUTF16(*e),
this, PR_TRUE, PR_TRUE, 2);
@ -275,7 +277,7 @@ nsresult nsRootAccessible::RemoveEventListeners()
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
if (target) {
for (const char* const* e = docEvents,
* const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents);
* const* e_end = ArrayEnd(docEvents);
e < e_end; ++e) {
nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -46,6 +46,7 @@
#include "nsIClipboard.h"
#include "nsContentCID.h"
#include "nsFocusManager.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
@ -908,17 +909,9 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
// or the start of a new line. Getting text at the line should provide the line with the visual caret,
// otherwise screen readers will announce the wrong line as the user presses up or down arrow and land
// at the end of a line.
nsCOMPtr<nsISelection> domSel;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryInterface(domSel));
nsRefPtr<nsFrameSelection> frameSelection;
rv = privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
NS_ENSURE_SUCCESS(rv, rv);
if (frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
if (frameSelection &&
frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
-- aOffset; // We are at the start of a line
}
}
@ -1587,26 +1580,33 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
// If range 0 was successfully set, clear any additional selection
// ranges remaining from previous selection
nsCOMPtr<nsISelection> domSel;
nsCOMPtr<nsISelectionController> selCon;
GetSelections(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(selCon), getter_AddRefs(domSel));
if (domSel) {
PRInt32 numRanges;
domSel->GetRangeCount(&numRanges);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
for (PRInt32 count = 0; count < numRanges - 1; count ++) {
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(1, getter_AddRefs(range));
domSel->RemoveRange(range);
}
nsCOMPtr<nsISelection> 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);
}
if (selCon) {
// XXX I'm not sure this can do synchronous scrolling. If the last param is
// set to true, this calling might flush the pending reflow. See bug 418470.
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION, 0);
// Now that selection is done, move the focus to the selection.
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
if (DOMFocusManager) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = shell->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> window = doc->GetWindow();
nsCOMPtr<nsIDOMElement> result;
DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET,
nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
}
return NS_OK;
@ -1635,13 +1635,15 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
// Turn the focus node and offset of the selection into caret hypretext
// offset.
nsCOMPtr<nsISelection> domSel;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsISelection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
nsCOMPtr<nsIDOMNode> focusDOMNode;
rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode));
nsresult rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 focusOffset;
@ -1665,18 +1667,19 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
return NS_OK;
}
PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
PRInt32
nsHyperTextAccessible::GetCaretLineNumber()
{
// Provide the line number for the caret, relative to the
// currently focused node. Use a 1-based index
nsCOMPtr<nsISelection> domSel;
GetSelections(nsISelectionController::SELECTION_NORMAL, nsnull,
getter_AddRefs(domSel));
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryInterface(domSel));
NS_ENSURE_TRUE(privateSelection, -1);
nsRefPtr<nsFrameSelection> frameSelection;
privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
NS_ENSURE_TRUE(frameSelection, -1);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
if (!frameSelection)
return -1;
nsISelection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
if (!domSel)
return - 1;
nsCOMPtr<nsIDOMNode> caretNode;
domSel->GetFocusNode(getter_AddRefs(caretNode));
@ -1731,104 +1734,70 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
return lineNumber;
}
nsresult
nsHyperTextAccessible::GetSelections(PRInt16 aType,
nsISelectionController **aSelCon,
nsISelection **aDomSel,
nsCOMArray<nsIDOMRange>* aRanges)
already_AddRefed<nsFrameSelection>
nsHyperTextAccessible::FrameSelection()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsIFrame* frame = GetFrame();
return frame->GetFrameSelection();
}
if (aSelCon) {
*aSelCon = nsnull;
}
if (aDomSel) {
*aDomSel = nsnull;
}
if (aRanges) {
aRanges->Clear();
}
nsCOMPtr<nsISelection> domSel;
nsCOMPtr<nsISelectionController> selCon;
void
nsHyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
nsCOMArray<nsIDOMRange>* aRanges)
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
if (!frameSelection)
return;
nsISelection* domSel = frameSelection->GetSelection(aType);
if (!domSel)
return;
nsCOMPtr<nsINode> startNode = GetNode();
nsCOMPtr<nsIEditor> editor;
GetAssociatedEditor(getter_AddRefs(editor));
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
if (peditor) {
// Case 1: plain text editor
// This is for form controls which have their own
// selection controller separate from the document, for example
// HTML:input, HTML:textarea, XUL:textbox, etc.
editor->GetSelectionController(getter_AddRefs(selCon));
}
else {
// Case 2: rich content subtree (can be rich editor)
// This uses the selection controller from the entire document
nsIFrame *frame = GetFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
// Get the selection and selection controller
frame->GetSelectionController(GetPresContext(),
getter_AddRefs(selCon));
}
NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
selCon->GetSelection(aType, getter_AddRefs(domSel));
NS_ENSURE_TRUE(domSel, NS_ERROR_FAILURE);
if (aSelCon) {
NS_ADDREF(*aSelCon = selCon);
}
if (aDomSel) {
NS_ADDREF(*aDomSel = domSel);
if (editor) {
nsCOMPtr<nsIDOMElement> editorRoot;
editor->GetRootElement(getter_AddRefs(editorRoot));
startNode = do_QueryInterface(editorRoot);
}
if (aRanges) {
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(domSel));
if (!startNode)
return;
nsCOMPtr<nsINode> startNode = GetNode();
if (peditor) {
nsCOMPtr<nsIDOMElement> editorRoot;
editor->GetRootElement(getter_AddRefs(editorRoot));
startNode = do_QueryInterface(editorRoot);
}
NS_ENSURE_STATE(startNode);
PRUint32 childCount = startNode->GetChildCount();
nsCOMPtr<nsIDOMNode> startDOMNode(do_QueryInterface(startNode));
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(domSel));
nsresult rv = privSel->
GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount,
true, aRanges);
NS_ENSURE_SUCCESS(rv,);
PRUint32 childCount = startNode->GetChildCount();
nsCOMPtr<nsIDOMNode> startDOMNode(do_QueryInterface(startNode));
nsresult rv = privSel->
GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount,
PR_TRUE, aRanges);
NS_ENSURE_SUCCESS(rv, rv);
// Remove collapsed ranges
PRInt32 numRanges = aRanges->Count();
for (PRInt32 count = 0; count < numRanges; count ++) {
bool isCollapsed;
(*aRanges)[count]->GetCollapsed(&isCollapsed);
if (isCollapsed) {
aRanges->RemoveObjectAt(count);
-- numRanges;
-- count;
}
// Remove collapsed ranges
PRInt32 numRanges = aRanges->Count();
for (PRInt32 count = 0; count < numRanges; count ++) {
bool isCollapsed = false;
(*aRanges)[count]->GetCollapsed(&isCollapsed);
if (isCollapsed) {
aRanges->RemoveObjectAt(count);
--numRanges;
--count;
}
}
return NS_OK;
}
/*
* Gets the number of selected regions.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetSelectionCount(PRInt32 *aSelectionCount)
NS_IMETHODIMP
nsHyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
{
nsCOMPtr<nsISelection> domSel;
nsCOMArray<nsIDOMRange> ranges;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, nsnull, &ranges);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_ARG_POINTER(aSelectionCount);
*aSelectionCount = 0;
nsCOMArray<nsIDOMRange> ranges;
GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges);
*aSelectionCount = ranges.Count();
return NS_OK;
@ -1837,15 +1806,17 @@ NS_IMETHODIMP nsHyperTextAccessible::GetSelectionCount(PRInt32 *aSelectionCount)
/*
* Gets the start and end offset of the specified selection.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
NS_IMETHODIMP
nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
PRInt32* aStartOffset,
PRInt32* aEndOffset)
{
NS_ENSURE_ARG_POINTER(aStartOffset);
NS_ENSURE_ARG_POINTER(aEndOffset);
*aStartOffset = *aEndOffset = 0;
nsCOMPtr<nsISelection> domSel;
nsCOMArray<nsIDOMRange> ranges;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel), &ranges);
NS_ENSURE_SUCCESS(rv, rv);
GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges);
PRInt32 rangeCount = ranges.Count();
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
@ -1857,18 +1828,19 @@ NS_IMETHODIMP nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, P
nsCOMPtr<nsIDOMNode> startDOMNode;
range->GetStartContainer(getter_AddRefs(startDOMNode));
nsCOMPtr<nsINode> startNode(do_QueryInterface(startDOMNode));
PRInt32 startOffset;
PRInt32 startOffset = 0;
range->GetStartOffset(&startOffset);
// Get end point
nsCOMPtr<nsIDOMNode> endDOMNode;
range->GetEndContainer(getter_AddRefs(endDOMNode));
nsCOMPtr<nsINode> endNode(do_QueryInterface(endDOMNode));
PRInt32 endOffset;
PRInt32 endOffset = 0;
range->GetEndOffset(&endOffset);
PRInt16 rangeCompareResult;
rv = range->CompareBoundaryPoints(nsIDOMRange::START_TO_END, range, &rangeCompareResult);
PRInt16 rangeCompareResult = 0;
nsresult rv = range->CompareBoundaryPoints(nsIDOMRange::START_TO_END, range,
&rangeCompareResult);
NS_ENSURE_SUCCESS(rv, rv);
if (rangeCompareResult < 0) {
@ -1898,15 +1870,17 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
PRInt32 aStartOffset,
PRInt32 aEndOffset)
{
nsCOMPtr<nsISelection> domSel;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
// Caret is a collapsed selection
bool isOnlyCaret = (aStartOffset == aEndOffset);
PRInt32 rangeCount;
PRInt32 rangeCount = 0;
domSel->GetRangeCount(&rangeCount);
nsCOMPtr<nsIDOMRange> range;
if (aSelectionNum == rangeCount) { // Add a range
@ -1921,12 +1895,12 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
}
PRInt32 startOffset, endOffset;
PRInt32 startOffset = 0, endOffset = 0;
nsCOMPtr<nsIDOMNode> startNode, endNode;
rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset,
getter_AddRefs(startNode), &startOffset,
getter_AddRefs(endNode), &endOffset);
nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset,
getter_AddRefs(startNode), &startOffset,
getter_AddRefs(endNode), &endOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = range->SetStart(startNode, startOffset);
@ -1936,23 +1910,30 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
range->SetEnd(endNode, endOffset);
NS_ENSURE_SUCCESS(rv, rv);
if (aSelectionNum == rangeCount) { // Add successfully created new range
// If new range was created then add it, otherwise notify selection listeners
// that existing selection range was changed.
if (aSelectionNum == rangeCount)
return domSel->AddRange(range);
}
domSel->RemoveRange(range);
domSel->AddRange(range);
return NS_OK;
}
/*
* Adds a selection bounded by the specified offsets.
*/
NS_IMETHODIMP nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
NS_IMETHODIMP
nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
{
nsCOMPtr<nsISelection> domSel;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
PRInt32 rangeCount;
nsCOMPtr<nsISelection> domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRInt32 rangeCount = 0;
domSel->GetRangeCount(&rangeCount);
return SetSelectionBounds(rangeCount, aStartOffset, aEndOffset);
@ -1961,12 +1942,15 @@ NS_IMETHODIMP nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32
/*
* Removes the specified selection.
*/
NS_IMETHODIMP nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
NS_IMETHODIMP
nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
{
nsCOMPtr<nsISelection> domSel;
nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL,
nsnull, getter_AddRefs(domSel));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
nsCOMPtr<nsISelection> domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
NS_ENSURE_STATE(domSel);
PRInt32 rangeCount;
domSel->GetRangeCount(&rangeCount);
@ -2348,9 +2332,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
{
nsCOMArray<nsIDOMRange> ranges;
nsresult rv = GetSelections(nsISelectionController::SELECTION_SPELLCHECK,
nsnull, nsnull, &ranges);
NS_ENSURE_SUCCESS(rv, rv);
GetSelectionDOMRanges(nsISelectionController::SELECTION_SPELLCHECK, &ranges);
PRInt32 rangeCount = ranges.Count();
if (!rangeCount)
@ -2362,7 +2344,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
NS_ENSURE_STATE(nsrange);
PRInt16 result;
rv = nsrange->ComparePoint(aNode, aNodeOffset, &result);
nsresult rv = nsrange->ComparePoint(aNode, aNodeOffset, &result);
NS_ENSURE_SUCCESS(rv, rv);
// ComparePoint checks boundary points, but we need to check that
// text at aNodeOffset is inside the range.
@ -2381,8 +2363,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
if (result == 1) { // range is before point
PRInt32 startHTOffset = 0;
rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_TRUE,
&startHTOffset);
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_TRUE,
&startHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
if (startHTOffset > *aHTStartOffset)
@ -2390,8 +2372,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
} else if (result == -1) { // range is after point
PRInt32 endHTOffset = 0;
rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_FALSE,
&endHTOffset);
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_FALSE,
&endHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
if (endHTOffset < *aHTEndOffset)
@ -2399,8 +2381,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
} else { // point is in range
PRInt32 startHTOffset = 0;
rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_TRUE,
&startHTOffset);
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_TRUE,
&startHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 endHTOffset = 0;

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

@ -351,22 +351,15 @@ protected:
// Selection helpers
/**
* Get the relevant selection interfaces and ranges for the current hyper
* text.
*
* @param aType [in] the selection type
* @param aSelCon [out, optional] the selection controller for the current
* hyper text
* @param aDomSel [out, optional] the selection interface for the current
* hyper text
* @param aRanges [out, optional] the selected ranges within the current
* subtree
/**
* Return frame selection object for the accessible.
*/
nsresult GetSelections(PRInt16 aType,
nsISelectionController **aSelCon,
nsISelection **aDomSel = nsnull,
nsCOMArray<nsIDOMRange>* aRanges = nsnull);
virtual already_AddRefed<nsFrameSelection> FrameSelection();
/**
* Return selection ranges within the accessible subtree.
*/
void GetSelectionDOMRanges(PRInt16 aType, nsCOMArray<nsIDOMRange>* aRanges);
nsresult SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos);

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

@ -882,6 +882,17 @@ nsXULTextFieldAccessible::CacheChildren()
while ((child = walker.NextChild()) && AppendChild(child));
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTextFieldAccessible: nsHyperTextAccessible protected
already_AddRefed<nsFrameSelection>
nsXULTextFieldAccessible::FrameSelection()
{
nsCOMPtr<nsIContent> inputContent(GetInputField());
nsIFrame* frame = inputContent->GetPrimaryFrame();
return frame->GetFrameSelection();
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTextFieldAccessible protected

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

@ -276,6 +276,9 @@ protected:
// nsAccessible
virtual void CacheChildren();
// nsHyperTextAccessible
virtual already_AddRefed<nsFrameSelection> FrameSelection();
// nsXULTextFieldAccessible
already_AddRefed<nsIContent> GetInputField() const;
};

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

@ -883,12 +883,7 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
bool
nsXULTreeItemAccessibleBase::IsDefunct() const
{
if (nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0)
return PR_TRUE;
PRInt32 rowCount = 0;
nsresult rv = mTreeView->GetRowCount(&rowCount);
return NS_FAILED(rv) || mRow >= rowCount;
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0;
}
void

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

@ -56,6 +56,7 @@ DIRS = \
states \
table \
text \
textselection \
tree \
treeupdate \
value \

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

@ -23,6 +23,7 @@ const EVENT_TEXT_ATTRIBUTE_CHANGED = nsIAccessibleEvent.EVENT_TEXT_ATTRIBUTE_CHA
const EVENT_TEXT_CARET_MOVED = nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED;
const EVENT_TEXT_INSERTED = nsIAccessibleEvent.EVENT_TEXT_INSERTED;
const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED;
const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED;
const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE;
////////////////////////////////////////////////////////////////////////////////

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

@ -34,9 +34,11 @@
/**
* Invokers.
*/
function setCaretOffsetInvoker(aID, aOffset)
function setCaretOffsetInvoker(aID, aOffset, aFocusableContainerID)
{
this.target = getAccessible(aID, [nsIAccessibleText]);
this.focus = aFocusableContainerID ?
getAccessible(aFocusableContainerID) : this.target;
this.invoke = function setCaretOffsetInvoker_invoke()
{
@ -45,29 +47,47 @@
this.getID = function setCaretOffsetInvoker_getID()
{
return "nsIAccessibleText::caretOffset test";
return "Set caretOffset on " + prettyName(aID) + " at " + aOffset;
}
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, this.target),
new caretMovedChecker(this.target, aOffset)
new caretMovedChecker(this.target, aOffset),
new asyncInvokerChecker(EVENT_FOCUS, this.focus)
];
}
/**
* Turn on/off the caret browsing mode.
*/
function turnCaretBrowsing(aIsOn)
{
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
}
/**
* Do tests.
*/
var gQueue = null;
// gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true;
function doTests()
{
turnCaretBrowsing(true);
// test caret move events and caret offsets
gQueue = new eventQueue();
gQueue.push(new setCaretOffsetInvoker("textbox", 1));
gQueue.push(new setCaretOffsetInvoker("link", 1));
gQueue.push(new setCaretOffsetInvoker("heading", 1, document));
gQueue.onFinish = function()
{
turnCaretBrowsing(false);
}
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -84,6 +104,11 @@
title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs">
Mozilla Bug 524115
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=546068"
title="Position is not being updated when atk_text_set_caret_offset is used">
Mozilla Bug 546068
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -91,6 +116,7 @@
<input id="textbox" value="hello"/>
<a id="link" href="about:">about mozilla</a>
<h5 id="heading">heading</h5>
<div id="eventdump"></div>
</body>

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

@ -0,0 +1,53 @@
#
# ***** 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 mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alexander Surkov <surkov.alexander@gmail.com> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of 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 *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/textselection
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_general.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)

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

@ -0,0 +1,170 @@
<html>
<head>
<title>Text selection testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
/**
* Invokers
*/
function addSelection(aID, aStartOffset, aEndOffset)
{
this.hyperTextNode = getNode(aID);
this.hyperText = getAccessible(aID, [ nsIAccessibleText ]);
this.eventSeq = [
new invokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID)
];
this.invoke = function addSelection_invoke()
{
this.hyperText.addSelection(aStartOffset, aEndOffset);
}
this.finalCheck = function addSelection_finalCheck()
{
is(this.hyperText.selectionCount, 1,
"addSelection: Wrong selection count for " + aID);
var startOffset = {}, endOffset = {};
this.hyperText.getSelectionBounds(0, startOffset, endOffset);
is(startOffset.value, aStartOffset,
"addSelection: Wrong start offset for " + aID);
is(endOffset.value, aEndOffset,
"addSelection: Wrong end offset for " + aID);
}
this.getID = function addSelection_getID()
{
return "nsIAccessibleText::addSelection test for " + aID;
}
}
function changeSelection(aID, aStartOffset, aEndOffset)
{
this.hyperTextNode = getNode(aID);
this.hyperText = getAccessible(aID, [ nsIAccessibleText ]);
this.eventSeq = [
new invokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID)
];
this.invoke = function changeSelection_invoke()
{
this.hyperText.setSelectionBounds(0, aStartOffset, aEndOffset);
}
this.finalCheck = function changeSelection_finalCheck()
{
is(this.hyperText.selectionCount, 1,
"setSelectionBounds: Wrong selection count for " + aID);
var startOffset = {}, endOffset = {};
this.hyperText.getSelectionBounds(0, startOffset, endOffset);
is(startOffset.value, aStartOffset,
"setSelectionBounds: Wrong start offset for " + aID);
is(endOffset.value, aEndOffset,
"setSelectionBounds: Wrong end offset for " + aID);
}
this.getID = function changeSelection_getID()
{
return "nsIAccessibleText::setSelectionBounds test for " + aID;
}
}
function removeSelection(aID)
{
this.hyperText = getAccessible(aID, [ nsIAccessibleText ]);
this.eventSeq = [
new invokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID)
];
this.invoke = function removeSelection_invoke()
{
this.hyperText.removeSelection(0);
}
this.finalCheck = function removeSelection_finalCheck()
{
is(this.hyperText.selectionCount, 0,
"removeSelection: Wrong selection count for " + aID);
}
this.getID = function removeSelection_getID()
{
return "nsIAccessibleText::removeSelection test for " + aID;
}
}
function onfocusEventSeq(aID)
{
var caretMovedChecker =
new invokerChecker(EVENT_TEXT_CARET_MOVED, aID);
var selChangedChecker =
new invokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID);
selChangedChecker.unexpected = true;
return [ caretMovedChecker, selChangedChecker ];
}
/**
* Do tests
*/
//gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null;
function doTests()
{
gQueue = new eventQueue();
gQueue.push(new addSelection("paragraph", 1, 3));
gQueue.push(new changeSelection("paragraph", 2, 4));
//gQueue.push(new removeSelection("paragraph"));
todo(false, "removeSelection doesn't fire text selection changed events, see bug bug 688124.");
gQueue.push(new synthFocus("textbox", onfocusEventSeq("textbox")));
gQueue.push(new changeSelection("textbox", 1, 3));
gQueue.push(new synthFocus("textarea", onfocusEventSeq("textarea")));
gQueue.push(new changeSelection("textarea", 1, 3));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=688126"
title="nsIAccessibleText::setSelectionBounds doesn't fire text selection changed events in some cases">
Mozilla Bug 688126
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<p id="paragraph">hello</p>
<input id="textbox" value="hello"/>
<textarea id="textarea">hello</textarea>
</body>
</html>

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

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1317659919000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
<emItems>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
@ -9,6 +9,8 @@
<versionRange minVersion=" " severity="1">
</versionRange>
</emItem>
<emItem blockID="i43" id="supportaccessplugin@gmail.com">
</emItem>
<emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@ -86,6 +88,8 @@
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i44" id="sigma@labs.mozilla">
</emItem>
<emItem blockID="i5" id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5">
</versionRange>

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

@ -1010,6 +1010,9 @@ pref("devtools.scratchpad.enabled", true);
// Enable tools for Chrome development.
pref("devtools.chrome.enabled", false);
// Disable the GCLI enhanced command line.
pref("devtools.gcli.enable", false);
// The last Web Console height. This is initially 0 which means that the Web
// Console will use the default height next time it shows.
// Change to -1 if you do not want the Web Console to remember its last height.

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

@ -867,7 +867,7 @@ let Items = {
getTopLevelItems: function Items_getTopLevelItems() {
var items = [];
iQ('.tab, .groupItem, .info-item').each(function(elem) {
iQ('.tab, .groupItem').each(function(elem) {
var $this = iQ(elem);
var item = $this.data('item');
if (item && !item.parent && !$this.hasClass('phantom'))

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

@ -132,10 +132,6 @@ input.name:focus {
position: absolute;
}
.info-item {
position: absolute;
}
/* Trenches
----------------------------------*/

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

@ -23,16 +23,33 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Cc = Components.classes;
const Ci = Components.interfaces;
function openContextMenuFor(element, shiftkey) {
function openContextMenuFor(element, shiftkey, shouldWaitForFocus) {
// Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed");
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
//Some elements need time to focus and spellcheck before any tests are
//run on them.
if(shouldWaitForFocus)
{
if (lastElement)
lastElement.blur();
element.focus();
SimpleTest.executeSoon(function() {
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
});
}
else
{
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
}
}
function closeContextMenu() {
@ -421,7 +438,7 @@ function runTest(testNum) {
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(textarea); // Invoke context menu for next test.
openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck.
break;
case 12:

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

@ -1,5 +1,4 @@
// Fight update fatigue by suppressing whatsnew tab opening after update (bug 685727)
pref("startup.homepage_override_url","");
pref("startup.homepage_override_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/whatsnew/");
pref("startup.homepage_welcome_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/firstrun/");
// Interval: Time between checks for a new version (in seconds)
// nightly=6 hours, official=24 hours

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

@ -39,6 +39,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include <stdio.h>
#include <string.h>
#include <windows.h>
@ -109,6 +111,8 @@
#define REGISTRY_IE_SEARCHURL_KEY \
NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\SearchUrl")
using namespace mozilla;
const int sInitialCookieBufferSize = 1024; // but it can grow
const int sUsernameLengthLimit = 80;
const int sHostnameLengthLimit = 255;
@ -1673,7 +1677,7 @@ nsIEProfileMigrator::CopyPreferences(bool aReplace)
{
bool regKeyOpen = false;
const regEntry *entry,
*endEntry = gRegEntries + NS_ARRAY_LENGTH(gRegEntries);
*endEntry = ArrayEnd(gRegEntries);
nsCOMPtr<nsIPrefBranch> prefs;
@ -2168,7 +2172,7 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs)
PRInt32 startIndex = 0, count = 0;
bool foundSpecificProxy = false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) {
for (PRUint32 i = 0; i < ArrayLength(data); ++i) {
PRInt32 offset = buf.Find(NS_ConvertASCIItoUTF16(data[i].prefix));
if (offset >= 0) {
foundSpecificProxy = PR_TRUE;
@ -2191,7 +2195,7 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs)
// No proxy config for any specific type was found, assume
// the ProxyServer value is of the form host:port and that
// it applies to all protocols.
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i)
for (PRUint32 i = 0; i < ArrayLength(data); ++i)
SetProxyPref(buf, data[i].hostPref, data[i].portPref, aPrefs);
aPrefs->SetBoolPref("network.proxy.share_proxy_settings", PR_TRUE);
}

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

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsBrowserProfileMigratorUtils.h"
#include "nsDirectoryServiceDefs.h"
@ -68,6 +70,8 @@
#include <windows.h>
#endif
using namespace mozilla;
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
#ifdef XP_WIN
@ -482,7 +486,7 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
char toggleBuf[15], serverBuf[20], serverPrefBuf[20],
serverPortPrefBuf[25];
PRInt32 enabled;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(protocols); ++i) {
for (PRUint32 i = 0; i < ArrayLength(protocols); ++i) {
sprintf(toggleBuf, "Use %s", protocols[i]);
GetInteger(aParser, "Proxy", toggleBuf, &enabled);
if (enabled) {

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

@ -630,7 +630,7 @@ let AboutPermissions = {
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
item.collapsed = aSite.host.toLowerCase().indexOf(filterValue) == -1;
this.sitesList.appendChild(item);
(this._listFragment || this.sitesList).appendChild(item);
},
startSitesListBatch: function () {

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

@ -65,8 +65,8 @@
<description value="&allowScripts.label;"/>
<checkbox id="moveResizeWindows" label="&moveResizeWindows.label;"
accesskey="&moveResizeWindows.accesskey;"
<checkbox id="moveResizePopupWindows" label="&moveResizePopupWindows.label;"
accesskey="&moveResizePopupWindows.accesskey;"
preference="dom.disable_window_move_resize"/>
<checkbox id="raiseLowerWindows" label="&raiseLowerWindows.label;"
accesskey="&raiseLowerWindows.accesskey;"

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

@ -22,6 +22,7 @@
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Steffen Wilberg <steffen.wilberg@web.de>
#
# 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
@ -61,9 +62,7 @@ var gAdvancedPane = {
}
#ifdef MOZ_UPDATER
this.updateAppUpdateItems();
this.updateAutoItems();
this.updateModeItems();
this.updateReadPrefs();
#endif
this.updateOfflineApps();
#ifdef MOZ_CRASHREPORTER
@ -459,82 +458,90 @@ var gAdvancedPane = {
* update is a major update
*/
#ifdef MOZ_UPDATER
/**
* Enables and disables various UI preferences as necessary to reflect locked,
* disabled, and checked/unchecked states.
* Selects the item of the radiogroup, and sets the warnIncompatible checkbox
* based on the pref values and locked states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* 1 = Firefox checkbox i = app.update.enabled
* 2 = When updates for Firefox are found label ii = app.update.auto
* 3 = Automatic Radiogroup (Ask vs. Automatically) iii = app.update.mode
* 4 = Warn before disabling extensions checkbox
*
* States:
* Element p val locked Disabled
* 1 i t/f f false
* i t/f t true
* ii t/f t/f false
* iii 0/1/2 t/f false
* 2,3 i t t/f false
* i f t/f true
* ii t/f f false
* ii t/f t true
* iii 0/1/2 t/f false
* 4 i t t/f false
* i f t/f true
* ii t t/f false
* ii f t/f true
* iii 0/1/2 f false
* iii 0/1/2 t true
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* Warn before disabling extensions checkbox ii = app.update.auto
* iii = app.update.mode
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
* iii 0/1/2 t/f false
* warnIncompatible i t f false
* i t *t* *true*
* i *f* t/f *true*
* ii t f false
* ii t *t* *true*
* ii *f* t/f *true*
* iii 0/1/2 f false
* iii 0/1/2 *t* *true*
*/
#ifdef MOZ_UPDATER
updateAppUpdateItems: function ()
{
var aus =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
var enabledPref = document.getElementById("app.update.enabled");
var enableAppUpdate = document.getElementById("enableAppUpdate");
enableAppUpdate.disabled = !aus.canCheckForUpdates || enabledPref.locked;
},
/**
* Enables/disables UI for "when updates are found" based on the values,
* and "locked" states of associated preferences.
*/
updateAutoItems: function ()
updateReadPrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var updateModeLabel = document.getElementById("updateModeLabel");
var updateMode = document.getElementById("updateMode");
var disable = enabledPref.locked || !enabledPref.value ||
autoPref.locked;
updateModeLabel.disabled = updateMode.disabled = disable;
},
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual" // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
/**
* Enables/disables the "warn if incompatible extensions/themes exist" UI
* based on the values and "locked" states of various preferences.
*/
updateModeItems: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var modePref = document.getElementById("app.update.mode");
var warnIncompatible = document.getElementById("warnIncompatible");
var disable = enabledPref.locked || !enabledPref.value || autoPref.locked ||
!autoPref.value || modePref.locked;
warnIncompatible.disabled = disable;
// the warnIncompatible checkbox value is set by readAddonWarn
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
!enabledPref.value || !autoPref.value;
},
/**
* Sets the pref values based on the selected item of the radiogroup,
* and sets the disabled state of the warnIncompatible checkbox accordingly.
*/
updateWritePrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
var warnIncompatible = document.getElementById("warnIncompatible");
var modePref = document.getElementById("app.update.mode");
warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
autoPref.locked || !autoPref.value ||
modePref.locked;
},
/**
@ -553,7 +560,7 @@ var gAdvancedPane = {
* of the preference so that the preference value can be properly restored if
* the user's preferences cannot adequately be expressed by a single checkbox.
*
* app.update.modee Checkbox State Meaning
* app.update.mode Checkbox State Meaning
* 0 Unchecked Do not warn
* 1 Checked Warn if there are incompatibilities
* 2 Checked Warn if there are incompatibilities,
@ -562,9 +569,9 @@ var gAdvancedPane = {
readAddonWarn: function ()
{
var preference = document.getElementById("app.update.mode");
var doNotWarn = preference.value != 0;
gAdvancedPane._modePreference = doNotWarn ? preference.value : 1;
return doNotWarn;
var warn = preference.value != 0;
gAdvancedPane._modePreference = warn ? preference.value : 1;
return warn;
},
/**
@ -591,7 +598,7 @@ var gAdvancedPane = {
/**
* The Extensions checkbox and button are disabled only if the enable Addon
* update preference is locked.
* update preference is locked.
*/
updateAddonUpdateUI: function ()
{
@ -599,8 +606,8 @@ var gAdvancedPane = {
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
enableAddonUpdate.disabled = enabledPref.locked;
},
},
// ENCRYPTION TAB
/*

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

@ -25,6 +25,7 @@
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
# Steffen Wilberg <steffen.wilberg@web.de>
#
# 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
@ -100,15 +101,9 @@
<!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled" name="app.update.enabled" type="bool"
onchange="gAdvancedPane.updateAppUpdateItems();
gAdvancedPane.updateAutoItems();
gAdvancedPane.updateModeItems();"/>
<preference id="app.update.auto" name="app.update.auto" type="bool"
onchange="gAdvancedPane.updateAutoItems();
gAdvancedPane.updateModeItems();"/>
<preference id="app.update.mode" name="app.update.mode" type="int"
onchange="gAdvancedPane.updateModeItems();"/>
<preference id="app.update.enabled" name="app.update.enabled" type="bool"/>
<preference id="app.update.auto" name="app.update.auto" type="bool"/>
<preference id="app.update.mode" name="app.update.mode" type="int"/>
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
@ -299,55 +294,51 @@
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical" align="start">
<label control="autoUpdateGroup">&autoCheck.label;</label>
<vbox class="indent" id="autoUpdateGroup" role="group">
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
<checkbox id="enableAppUpdate"
label="&enableAppUpdate.label;"
accesskey="&enableAppUpdate.accesskey;"
preference="app.update.enabled"/>
<groupbox id="updateApp">
<caption label="&updateApp.label;"/>
<radiogroup id="updateRadioGroup"
oncommand="gAdvancedPane.updateWritePrefs();">
<radio value="auto"
label="&updateAuto.label;"
accesskey="&updateAuto.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&updateAutoAddonWarn.label;"
accesskey="&updateAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
<radio value="checkOnly"
label="&updateCheck.label;"
accesskey="&updateCheck.accesskey;"/>
<radio value="manual"
label="&updateManual.label;"
accesskey="&updateManual.accesskey;"/>
</radiogroup>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
</groupbox>
#endif
<groupbox id="updateOthers">
<caption label="&updateOthers.label;"/>
<checkbox id="enableAddonUpdate"
label="&enableAddonsUpdate2.label;"
accesskey="&enableAddonsUpdate2.accesskey;"
label="&enableAddonsUpdate3.label;"
accesskey="&enableAddonsUpdate3.accesskey;"
preference="extensions.update.enabled"/>
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate.label;"
accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</vbox>
#ifdef MOZ_UPDATER
<separator id="updateSeparator1"/>
<label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label>
<radiogroup id="updateMode" class="indent"
preference="app.update.auto">
<radio id="ask" value="false"
label="&askMe.label;"
accesskey="&askMe.accesskey;"/>
<radio id="automatic" value="true"
label="&modeAutomatic.label;"
accesskey="&modeAutomatic.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&modeAutoAddonWarn.label;" accesskey="&modeAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
</radiogroup>
<separator id="updateSeparator2"/>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;" accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
#endif
</groupbox>
</tabpanel>
<!-- Encryption -->

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

@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
#include "nsGNOMEShellService.h"
#include "nsShellService.h"
@ -68,6 +70,8 @@
#include <limits.h>
#include <stdlib.h>
using namespace mozilla;
struct ProtocolAssociation
{
const char *name;
@ -239,7 +243,7 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
nsCAutoString handler;
nsCOMPtr<nsIGIOMimeApp> gioApp;
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (!appProtocols[i].essential)
continue;
@ -295,7 +299,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
appKeyValue.AppendLiteral(" %s");
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
appKeyValue);
@ -328,7 +332,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
NS_ENSURE_SUCCESS(rv, rv);
// set handler for the protocols
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
appInfo->SetAsDefaultForURIScheme(nsDependentCString(appProtocols[i].name));
}
@ -337,7 +341,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
// set handler for .html and xhtml files and MIME types:
if (aClaimAllTypes) {
// Add mime types for html, xhtml extension and set app to just created appinfo.
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
for (unsigned int i = 0; i < ArrayLength(appTypes); ++i) {
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
}

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

@ -440,6 +440,8 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
NS_IMETHODIMP
nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
// If we've already checked, the browser has been started and this is a
// new window open, and we don't want to check again.
if (mCheckedThisSession) {
@ -448,26 +450,29 @@ nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult)
}
nsCOMPtr<nsIPrefBranch> prefs;
nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pserve)
pserve->GetBranch("", getter_AddRefs(prefs));
nsresult rv;
nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
rv = pserve->GetBranch("", getter_AddRefs(prefs));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
return prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
}
NS_IMETHODIMP
nsWindowsShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
{
nsCOMPtr<nsIPrefBranch> prefs;
nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pserve)
pserve->GetBranch("", getter_AddRefs(prefs));
nsresult rv;
prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
rv = pserve->GetBranch("", getter_AddRefs(prefs));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
return prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
}
static nsresult

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

@ -1,9 +1,4 @@
ac_add_options --enable-application=browser
ac_add_options --enable-debug
ac_add_options --enable-libxul
ac_add_options --enable-tests
ac_add_options --enable-trace-malloc
CC=/tools/gcc-4.5/bin/gcc
@ -11,13 +6,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,5 +1,4 @@
ac_add_options --with-l10n-base=../../l10n-central
ac_add_options --enable-application=browser
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging

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

@ -1,9 +1,5 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-codesighs
# Nightlies only since this has a cost in performance
@ -14,13 +10,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,9 +1,4 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-codesighs
CC=/tools/gcc-4.5/bin/gcc
@ -11,13 +6,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,9 +1,5 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-official-branding
CC=/tools/gcc-4.5/bin/gcc
@ -11,13 +7,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# PGO
mk_add_options MOZ_PGO=1
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'

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

@ -1,9 +1,4 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-codesighs
# Options for rpm versions of mozconfigs
@ -19,13 +14,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,8 +1,4 @@
ac_add_options --enable-application=browser
ac_add_options --enable-debug
ac_add_options --enable-tests
ac_add_options --enable-trace-malloc
CC=/tools/gcc-4.5/bin/gcc
@ -10,13 +6,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
#export CFLAGS="-gdwarf-2"
#export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,5 +1,4 @@
ac_add_options --with-l10n-base=../../l10n-central
ac_add_options --enable-application=browser
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging

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

@ -1,9 +1,5 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-codesighs
# Nightlies only since this has a cost in performance
@ -14,13 +10,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,9 +1,5 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-official-branding
CC=/tools/gcc-4.5/bin/gcc
@ -11,13 +7,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# PGO
mk_add_options MOZ_PGO=1
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'

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

@ -1,9 +1,4 @@
ac_add_options --enable-application=browser
ac_add_options --enable-optimize
ac_add_options --enable-update-packaging
ac_add_options --disable-debug
ac_add_options --enable-tests
ac_add_options --enable-codesighs
# Options for rpm versions of mozconfigs
@ -19,13 +14,6 @@ CXX=/tools/gcc-4.5/bin/g++
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,22 +1,16 @@
. $topsrcdir/build/macosx/universal/mozconfig
# Universal builds override the default of browser (bug 575283 comment 29)
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-tests
ac_add_options --enable-codesighs
ac_add_options --disable-install-strip
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,18 +1,12 @@
. $topsrcdir/build/macosx/universal/mozconfig
# Universal builds override the default of browser (bug 575283 comment 29)
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-tests
ac_add_options --enable-official-branding
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -2,17 +2,12 @@
# shark and dtrace enabled
. $topsrcdir/build/macosx/universal/mozconfig
# Universal builds override the default of browser (bug 575283 comment 29)
ac_add_options --enable-application=browser
ac_add_options --disable-tests
ac_add_options --disable-install-strip
export CFLAGS="-gdwarf-2"
export CXXFLAGS="-gdwarf-2"
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
@ -22,7 +17,6 @@ mk_add_options MOZ_MAKE_FLAGS="-j4"
# shark specific options
ac_add_options --enable-shark
ac_add_options --enable-dtrace
ac_add_options --enable-debugger-info-modules
# Need this to prevent name conflicts with the normal nightly build packages
export MOZ_PKG_SPECIAL="shark"

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

@ -2,18 +2,9 @@
#. $topsrcdir/build/macosx/universal/mozconfig
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_options --enable-debug
ac_add_options --enable-libxul
ac_add_options --enable-application=browser
ac_add_options --enable-tests
ac_add_options --enable-trace-malloc
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j4"

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

@ -1,15 +1,7 @@
ac_add_options --enable-debug
ac_add_options --enable-libxul
ac_add_options --enable-application=browser
ac_add_options --enable-tests
ac_add_options --enable-trace-malloc
ac_add_options --enable-accessibility
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j4"

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

@ -1,5 +1,4 @@
ac_add_options --with-l10n-base=../../l10n-central
ac_add_options --enable-application=browser
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging

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

@ -1,12 +1,5 @@
ac_add_options --enable-application=browser
ac_add_options --enable-jemalloc
ac_add_options --enable-debug
ac_add_options --enable-libxul
ac_add_options --enable-trace-malloc
ac_add_options --enable-tests
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,4 +1,3 @@
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-official-branding

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

@ -1,18 +1,13 @@
# for pgo
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profileserver.py'
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-tests
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -2,16 +2,11 @@
mk_add_options MOZ_PGO=1
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profileserver.py'
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-tests
ac_add_options --enable-official-branding
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

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

@ -1,10 +1,7 @@
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
ac_add_options --enable-application=browser
ac_add_options --enable-jemalloc
ac_add_options --enable-debug
ac_add_options --enable-libxul
ac_add_options --enable-trace-malloc
# Needed to enable breakpad in application.ini

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

@ -4,11 +4,9 @@ ac_add_options --host=x86_64-pc-mingw32
# for pgo
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profileserver.py'
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-debug-symbols
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics

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

@ -6,4 +6,5 @@ browser.jar:
content/browser/csshtmltree.xhtml (styleinspector/csshtmltree.xhtml)
content/browser/orion.js (sourceeditor/orion/orion.js)
content/browser/orion.css (sourceeditor/orion/orion.css)
content/browser/orion-mozilla.css (sourceeditor/orion/mozilla.css)

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

@ -12,15 +12,17 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is HUDService code.
# The Original Code is the Style Inspector.
#
# The Initial Developer of the Original Code is Mozilla Corporation.
#
# Portions created by the Initial Developer are Copyright (C) 2010
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Ratcliffe <mratcliffe@mozilla.com> (Original author)
# Mike Ratcliffe <mratcliffe@mozilla.com> (Original author)
# Joe Walker <jwalker@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
@ -44,12 +46,11 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
# DIRS += test # no tests yet
endif
DIRS += test
endif
include $(topsrcdir)/config/rules.mk
libs::
$(NSINSTALL) $(srcdir)/Templater.jsm $(FINAL_TARGET)/modules/devtools
$(NSINSTALL) $(srcdir)/Promise.jsm $(FINAL_TARGET)/modules/devtools

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

@ -0,0 +1,215 @@
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var EXPORTED_SYMBOLS = [ "Promise" ];
/**
* Create an unfulfilled promise
* @constructor
*/
function Promise() {
this._status = Promise.PENDING;
this._value = undefined;
this._onSuccessHandlers = [];
this._onErrorHandlers = [];
// Debugging help
this._id = Promise._nextId++;
Promise._outstanding[this._id] = this;
}
/**
* We give promises and ID so we can track which are outstanding
*/
Promise._nextId = 0;
/**
* Outstanding promises. Handy list for debugging only
*/
Promise._outstanding = [];
/**
* Recently resolved promises. Also for debugging only
*/
Promise._recent = [];
/**
* A promise can be in one of 2 states.
* The ERROR and SUCCESS states are terminal, the PENDING state is the only
* start state.
*/
Promise.ERROR = -1;
Promise.PENDING = 0;
Promise.SUCCESS = 1;
/**
* Yeay for RTTI
*/
Promise.prototype.isPromise = true;
/**
* Have we either been resolve()ed or reject()ed?
*/
Promise.prototype.isComplete = function() {
return this._status != Promise.PENDING;
};
/**
* Have we resolve()ed?
*/
Promise.prototype.isResolved = function() {
return this._status == Promise.SUCCESS;
};
/**
* Have we reject()ed?
*/
Promise.prototype.isRejected = function() {
return this._status == Promise.ERROR;
};
/**
* Take the specified action of fulfillment of a promise, and (optionally)
* a different action on promise rejection
*/
Promise.prototype.then = function(onSuccess, onError) {
if (typeof onSuccess === 'function') {
if (this._status === Promise.SUCCESS) {
onSuccess.call(null, this._value);
}
else if (this._status === Promise.PENDING) {
this._onSuccessHandlers.push(onSuccess);
}
}
if (typeof onError === 'function') {
if (this._status === Promise.ERROR) {
onError.call(null, this._value);
}
else if (this._status === Promise.PENDING) {
this._onErrorHandlers.push(onError);
}
}
return this;
};
/**
* Like then() except that rather than returning <tt>this</tt> we return
* a promise which resolves when the original promise resolves
*/
Promise.prototype.chainPromise = function(onSuccess) {
var chain = new Promise();
chain._chainedFrom = this;
this.then(function(data) {
try {
chain.resolve(onSuccess(data));
}
catch (ex) {
chain.reject(ex);
}
}, function(ex) {
chain.reject(ex);
});
return chain;
};
/**
* Supply the fulfillment of a promise
*/
Promise.prototype.resolve = function(data) {
return this._complete(this._onSuccessHandlers,
Promise.SUCCESS, data, 'resolve');
};
/**
* Renege on a promise
*/
Promise.prototype.reject = function(data) {
return this._complete(this._onErrorHandlers, Promise.ERROR, data, 'reject');
};
/**
* Internal method to be called on resolve() or reject()
* @private
*/
Promise.prototype._complete = function(list, status, data, name) {
// Complain if we've already been completed
if (this._status != Promise.PENDING) {
if (typeof 'console' === 'object') {
console.error('Promise complete. Attempted ' + name + '() with ', data);
console.error('Prev status = ', this._status, ', value = ', this._value);
}
throw new Error('Promise already complete');
}
this._status = status;
this._value = data;
// Call all the handlers, and then delete them
list.forEach(function(handler) {
handler.call(null, this._value);
}, this);
delete this._onSuccessHandlers;
delete this._onErrorHandlers;
// Remove the given {promise} from the _outstanding list, and add it to the
// _recent list, pruning more than 20 recent promises from that list
delete Promise._outstanding[this._id];
// The original code includes this very useful debugging aid, however there
// is concern that it will create a memory leak, so we leave it out here.
/*
Promise._recent.push(this);
while (Promise._recent.length > 20) {
Promise._recent.shift();
}
*/
return this;
};
/**
* Takes an array of promises and returns a promise that that is fulfilled once
* all the promises in the array are fulfilled
* @param promiseList The array of promises
* @return the promise that is fulfilled when all the array is fulfilled
*/
Promise.group = function(promiseList) {
if (!Array.isArray(promiseList)) {
promiseList = Array.prototype.slice.call(arguments);
}
// If the original array has nothing in it, return now to avoid waiting
if (promiseList.length === 0) {
return new Promise().resolve([]);
}
var groupPromise = new Promise();
var results = [];
var fulfilled = 0;
var onSuccessFactory = function(index) {
return function(data) {
results[index] = data;
fulfilled++;
// If the group has already failed, silently drop extra results
if (groupPromise._status !== Promise.ERROR) {
if (fulfilled === promiseList.length) {
groupPromise.resolve(results);
}
}
};
};
promiseList.forEach(function(promise, index) {
var onSuccess = onSuccessFactory(index);
var onError = groupPromise.reject.bind(groupPromise);
promise.then(onSuccess, onError);
});
return groupPromise;
};

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

@ -1,5 +1,3 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -13,11 +11,11 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Bespin.
* The Original Code is GCLI
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@ -39,14 +37,10 @@
* ***** END LICENSE BLOCK ***** */
var EXPORTED_SYMBOLS = ["Templater"];
var EXPORTED_SYMBOLS = [ "Templater" ];
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
const Node = Ci.nsIDOMNode;
Components.utils.import("resource://gre/modules/Services.jsm");
const Node = Components.interfaces.nsIDOMNode;
// WARNING: do not 'use_strict' without reading the notes in _envEval();
@ -263,9 +257,9 @@ Templater.prototype._processForEachMember = function(member, template, siblingNo
try {
this._handleAsync(member, siblingNode, function(reply, node) {
data[paramName] = reply;
if (node.nodeName.toLowerCase() === 'loop') {
for (var i = 0; i < node.childNodes.length; i++) {
var clone = node.childNodes[i].cloneNode(true);
if (template.nodeName.toLowerCase() === 'loop') {
for (var i = 0; i < template.childNodes.length; i++) {
var clone = template.childNodes[i].cloneNode(true);
node.parentNode.insertBefore(clone, node);
this.processNode(clone, data);
}
@ -331,7 +325,7 @@ Templater.prototype._toNode = function(thing, document) {
if (thing == null) {
thing = '' + thing;
}
// if (isDOMElement(reply)) { ... }
// if thing isn't a DOM element then wrap its string value in one
if (typeof thing.cloneNode !== 'function') {
thing = document.createTextNode(thing.toString());
}
@ -387,7 +381,7 @@ Templater.prototype._stripBraces = function(str) {
* </ul>
* @param path An array of strings indicating the path through the data, or
* a string to be cut into an array using <tt>split('.')</tt>
* @param data An object to look in for the <tt>path</tt> argument
* @param data the data to use for node processing
* @param newValue (optional) If defined, this value will replace the
* original value for the data at the path specified.
* @return The value pointed to by <tt>path</tt> before any
@ -470,4 +464,3 @@ Templater.prototype._handleError = function(message, ex) {
Templater.prototype._logError = function(message) {
Services.console.logStringMessage(message);
};

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

@ -0,0 +1,63 @@
#
# ***** 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 GCLI.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Joe Walker <jwalker@mozilla.com> (Original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of 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 *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/devtools/shared/test
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
browser_promise_basic.js \
browser_templater_basic.js \
head.js \
$(NULL)
_BROWSER_TEST_PAGES = \
browser_templater_basic.html \
$(NULL)
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
libs:: $(_BROWSER_TEST_PAGES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

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

@ -0,0 +1,212 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that our Promise implementation works properly
Cu.import("resource:///modules/devtools/Promise.jsm");
function test() {
addTab("about:blank", function() {
info("Starting Promise Tests");
testBasic();
});
}
var postResolution;
function testBasic() {
postResolution = new Promise();
ok(postResolution.isPromise, "We have a promise");
ok(!postResolution.isComplete(), "Promise is initially incomplete");
ok(!postResolution.isResolved(), "Promise is initially unresolved");
ok(!postResolution.isRejected(), "Promise is initially unrejected");
// Test resolve() *after* then() in the same context
var reply = postResolution.then(testPostResolution, fail)
.resolve("postResolution");
is(reply, postResolution, "return this; working ok");
}
var preResolution;
function testPostResolution(data) {
is(data, "postResolution", "data is postResolution");
ok(postResolution.isComplete(), "postResolution Promise is complete");
ok(postResolution.isResolved(), "postResolution Promise is resolved");
ok(!postResolution.isRejected(), "postResolution Promise is unrejected");
try {
info("Expected double resolve error");
postResolution.resolve("double resolve");
ok(false, "double resolve");
}
catch (ex) {
// Expected
}
// Test resolve() *before* then() in the same context
preResolution = new Promise();
var reply = preResolution.resolve("preResolution")
.then(testPreResolution, fail);
is(reply, preResolution, "return this; working ok");
}
var laterResolution;
function testPreResolution(data) {
is(data, "preResolution", "data is preResolution");
ok(preResolution.isComplete(), "preResolution Promise is complete");
ok(preResolution.isResolved(), "preResolution Promise is resolved");
ok(!preResolution.isRejected(), "preResolution Promise is unrejected");
// Test resolve() *after* then() in a later context
laterResolution = new Promise();
laterResolution.then(testLaterResolution, fail);
executeSoon(function() {
laterResolution.resolve("laterResolution");
});
}
var laterRejection;
function testLaterResolution(data) {
is(data, "laterResolution", "data is laterResolution");
ok(laterResolution.isComplete(), "laterResolution Promise is complete");
ok(laterResolution.isResolved(), "laterResolution Promise is resolved");
ok(!laterResolution.isRejected(), "laterResolution Promise is unrejected");
// Test reject() *after* then() in a later context
laterRejection = new Promise().then(fail, testLaterRejection);
executeSoon(function() {
laterRejection.reject("laterRejection");
});
}
function testLaterRejection(data) {
is(data, "laterRejection", "data is laterRejection");
ok(laterRejection.isComplete(), "laterRejection Promise is complete");
ok(!laterRejection.isResolved(), "laterRejection Promise is unresolved");
ok(laterRejection.isRejected(), "laterRejection Promise is rejected");
// Test chaining
var orig = new Promise();
orig.chainPromise(function(data) {
is(data, "origData", "data is origData");
return data.replace(/orig/, "new");
}).then(function(data) {
is(data, "newData", "data is newData");
testChain();
});
orig.resolve("origData");
}
var member1;
var member2;
var member3;
var laterGroup;
function testChain() {
// Test an empty group
var empty1 = Promise.group();
ok(empty1.isComplete(), "empty1 Promise is complete");
ok(empty1.isResolved(), "empty1 Promise is resolved");
ok(!empty1.isRejected(), "empty1 Promise is unrejected");
// Test a group with no members
var empty2 = Promise.group([]);
ok(empty2.isComplete(), "empty2 Promise is complete");
ok(empty2.isResolved(), "empty2 Promise is resolved");
ok(!empty2.isRejected(), "empty2 Promise is unrejected");
// Test grouping using resolve() in a later context
member1 = new Promise();
member2 = new Promise();
member3 = new Promise();
laterGroup = Promise.group(member1, member2, member3);
laterGroup.then(testLaterGroup, fail);
member1.then(function(data) {
is(data, "member1", "member1 is member1");
executeSoon(function() {
member2.resolve("member2");
});
}, fail);
member2.then(function(data) {
is(data, "member2", "member2 is member2");
executeSoon(function() {
member3.resolve("member3");
});
}, fail);
member3.then(function(data) {
is(data, "member3", "member3 is member3");
// The group should now fire
}, fail);
executeSoon(function() {
member1.resolve("member1");
});
}
var tidyGroup;
function testLaterGroup(data) {
is(data[0], "member1", "member1 is member1");
is(data[1], "member2", "member2 is member2");
is(data[2], "member3", "member3 is member3");
is(data.length, 3, "data.length is right");
ok(laterGroup.isComplete(), "laterGroup Promise is complete");
ok(laterGroup.isResolved(), "laterGroup Promise is resolved");
ok(!laterGroup.isRejected(), "laterGroup Promise is unrejected");
// Test grouping resolve() *before* then() in the same context
tidyGroup = Promise.group([
postResolution, preResolution, laterResolution,
member1, member2, member3, laterGroup
]);
tidyGroup.then(testTidyGroup, fail);
}
var failGroup;
function testTidyGroup(data) {
is(data[0], "postResolution", "postResolution is postResolution");
is(data[1], "preResolution", "preResolution is preResolution");
is(data[2], "laterResolution", "laterResolution is laterResolution");
is(data[3], "member1", "member1 is member1");
is(data[6][1], "member2", "laterGroup is laterGroup");
is(data.length, 7, "data.length is right");
ok(tidyGroup.isComplete(), "tidyGroup Promise is complete");
ok(tidyGroup.isResolved(), "tidyGroup Promise is resolved");
ok(!tidyGroup.isRejected(), "tidyGroup Promise is unrejected");
// Test grouping resolve() *before* then() in the same context
failGroup = Promise.group(postResolution, laterRejection);
failGroup.then(fail, testFailGroup);
}
function testFailGroup(data) {
is(data, "laterRejection", "laterRejection is laterRejection");
postResolution = undefined;
preResolution = undefined;
laterResolution = undefined;
member1 = undefined;
member2 = undefined;
member3 = undefined;
laterGroup = undefined;
laterRejection = undefined;
finished();
}
function fail() {
gBrowser.removeCurrentTab();
info("Failed Promise Tests");
ok(false, "fail called");
finish();
}
function finished() {
gBrowser.removeCurrentTab();
info("Finishing Promise Tests");
finish();
}

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

@ -0,0 +1,13 @@
<!doctype html>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<title>DOM Template Tests</title>
</head>
<body>
</body>
</html>

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

@ -0,0 +1,207 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the DOM Template engine works properly
Cu.import("resource:///modules/devtools/Templater.jsm");
Cu.import("resource:///modules/devtools/Promise.jsm");
function test() {
addTab("http://example.com/browser/browser/devtools/shared/test/browser_templater_basic.html", function() {
info("Starting DOM Templater Tests");
runTest(0);
});
}
function runTest(index) {
var options = tests[index] = tests[index]();
var holder = content.document.createElement('div');
holder.id = options.name;
var body = content.document.body;
body.appendChild(holder);
holder.innerHTML = options.template;
info('Running ' + options.name);
new Templater().processNode(holder, options.data);
if (typeof options.result == 'string') {
is(holder.innerHTML, options.result, options.name);
}
else {
ok(holder.innerHTML.match(options.result), options.name);
}
if (options.also) {
options.also(options);
}
function runNextTest() {
index++;
if (index < tests.length) {
runTest(index);
}
else {
finished();
}
}
if (options.later) {
var ais = is.bind(this);
function createTester(holder, options) {
return function() {
ais(holder.innerHTML, options.later, options.name + ' later');
runNextTest();
}.bind(this);
}
executeSoon(createTester(holder, options));
}
else {
runNextTest();
}
}
function finished() {
gBrowser.removeCurrentTab();
info("Finishing DOM Templater Tests");
tests = null;
finish();
}
/**
* Why have an array of functions that return data rather than just an array
* of the data itself? Some of these tests contain calls to delayReply() which
* sets up async processing using executeSoon(). Since the execution of these
* tests is asynchronous, the delayed reply will probably arrive before the
* test is executed, making the test be synchronous. So we wrap the data in a
* function so we only set it up just before we use it.
*/
var tests = [
function() { return {
name: 'simpleNesting',
template: '<div id="ex1">${nested.value}</div>',
data: { nested:{ value:'pass 1' } },
result: '<div id="ex1">pass 1</div>'
};},
function() { return {
name: 'returnDom',
template: '<div id="ex2">${__element.ownerDocument.createTextNode(\'pass 2\')}</div>',
data: {},
result: '<div id="ex2">pass 2</div>'
};},
function() { return {
name: 'srcChange',
template: '<img _src="${fred}" id="ex3">',
data: { fred:'green.png' },
result: /<img( id="ex3")? src="green.png"( id="ex3")?>/
};},
function() { return {
name: 'ifTrue',
template: '<p if="${name !== \'jim\'}">hello ${name}</p>',
data: { name: 'fred' },
result: '<p>hello fred</p>'
};},
function() { return {
name: 'ifFalse',
template: '<p if="${name !== \'jim\'}">hello ${name}</p>',
data: { name: 'jim' },
result: ''
};},
function() { return {
name: 'simpleLoop',
template: '<p foreach="index in ${[ 1, 2, 3 ]}">${index}</p>',
data: {},
result: '<p>1</p><p>2</p><p>3</p>'
};},
function() { return {
name: 'loopElement',
template: '<loop foreach="i in ${array}">${i}</loop>',
data: { array: [ 1, 2, 3 ] },
result: '123'
};},
// Bug 692031: DOMTemplate async loops do not drop the loop element
function() { return {
name: 'asyncLoopElement',
template: '<loop foreach="i in ${array}">${i}</loop>',
data: { array: delayReply([1, 2, 3]) },
result: '<span></span>',
later: '123'
};},
function() { return {
name: 'saveElement',
template: '<p save="${element}">${name}</p>',
data: { name: 'pass 8' },
result: '<p>pass 8</p>',
also: function(options) {
ok(options.data.element.innerHTML, 'pass 9', 'saveElement saved');
delete options.data.element;
}
};},
function() { return {
name: 'useElement',
template: '<p id="pass9">${adjust(__element)}</p>',
data: {
adjust: function(element) {
is('pass9', element.id, 'useElement adjust');
return 'pass 9b'
}
},
result: '<p id="pass9">pass 9b</p>'
};},
function() { return {
name: 'asyncInline',
template: '${delayed}',
data: { delayed: delayReply('inline') },
result: '<span></span>',
later: 'inline'
};},
function() { return {
name: 'asyncArray',
template: '<p foreach="i in ${delayed}">${i}</p>',
data: { delayed: delayReply([1, 2, 3]) },
result: '<span></span>',
later: '<p>1</p><p>2</p><p>3</p>'
};},
function() { return {
name: 'asyncMember',
template: '<p foreach="i in ${delayed}">${i}</p>',
data: { delayed: [delayReply(4), delayReply(5), delayReply(6)] },
result: '<span></span><span></span><span></span>',
later: '<p>4</p><p>5</p><p>6</p>'
};},
function() { return {
name: 'asyncBoth',
template: '<p foreach="i in ${delayed}">${i}</p>',
data: {
delayed: delayReply([
delayReply(4),
delayReply(5),
delayReply(6)
])
},
result: '<span></span>',
later: '<p>4</p><p>5</p><p>6</p>'
};}
];
function delayReply(data) {
var p = new Promise();
executeSoon(function() {
p.resolve(data);
});
return p;
}

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

@ -1,4 +1,3 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -12,20 +11,20 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
* The Original Code is DevTools test code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* The Mozilla Foundation.
*
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
* Joe Walker <jwalker@mozilla.com> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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"),
* 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
@ -37,10 +36,32 @@
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
let tab;
let browser;
[scriptable, uuid(d67bd267-f984-4993-b378-95851b71f0a3)]
interface nsIDOMNSHTMLFrameElement : nsISupports
function addTab(aURL, aCallback)
{
readonly attribute nsIDOMWindow contentWindow;
};
waitForExplicitFinish();
function onTabLoad() {
browser.removeEventListener("load", onTabLoad, true);
aCallback();
}
gBrowser.selectedTab = gBrowser.addTab();
content.location = aURL;
tab = gBrowser.selectedTab;
browser = gBrowser.getBrowserForTab(tab);
browser.addEventListener("load", onTabLoad, true);
}
registerCleanupFunction(function tearDown() {
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
tab = undefined;
browser = undefined;
});

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

@ -8,8 +8,8 @@ The Orion editor web site: http://www.eclipse.org/orion
To upgrade Orion to a newer version see the UPGRADE file.
Orion version: git clone from 2011-07-06 (after the 0.2 release)
commit hash b19bc0b0f4e2843823bb1b8c8b4a64395c59e617
Orion version: git clone from 2011-10-07
commit hash eedba6403b6dff4536bc0469d31126c3485deb56
# License

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

@ -0,0 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
.rulerLines {
background: -moz-Dialog;
color: -moz-DialogText;
min-width: 1.4em;
padding-left: 4px;
padding-right: 4px;
}

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

@ -8,53 +8,75 @@
}
.viewContent {
}.ruler_annotation {
background-color: #e1ebfb;
width: 16px;
}
.ruler_annotation_todo {
}
.ruler_annotation_todo_overview {
background-color: lightgreen;
border: 1px solid green;
}
.ruler_annotation_breakpoint {
}
.ruler_annotation_breakpoint_overview {
background-color: lightblue;
border: 1px solid blue;
}
.ruler_lines {
background-color: #e1ebfb;
border-right: 1px solid #b1badf;
text-align: right;
}
.ruler_overview {
background-color: #e1ebfb;
}
.ruler_lines_even {
background-color: #e1ebfb;
}
.ruler_lines_odd {
}/* Styles for rulers */
.ruler {
background-color: white;
}
.ruler.annotations {
border-right: 1px solid lightgray;
width: 16px;
}
.ruler.folding {
border-right: 1px solid lightgray;
width: 14px;
}
.ruler.lines {
border-right: 1px solid lightgray;
text-align: right;
}
.ruler.overview {
width: 14px;
}
.token_comment {
/* Styles for the line number ruler */
.rulerLines {
background-color: white;
}
.rulerLines.even
.rulerLines.odd {
}
/* Styles for the ruler tooltips */
.rulerTooltip {
font-family: monospace;
font-size: 10pt;
background-color: InfoBackground;
color: InfoText;
padding: 2px;
border-radius: 4px;
border: 1px solid black;
z-index: 100;
position: absolute;
overflow: hidden;
white-space: pre;
}
.rulerTooltip em {
font-style: normal;
font-weight: bold;
}.token_singleline_comment {
color: green;
}
.token_javadoc {
.token_multiline_comment {
color: green;
}
.token_doc_comment {
color: #00008F;
}
.token_doc_html_markup {
color: #7F7F9F;
}
.token_doc_tag {
color: #7F9FBF;
}
.token_task_tag {
color: #7F9FBF;
}
.token_string {
color: blue;
}
@ -74,20 +96,24 @@
}
.token_space {
background-image: url('/examples/textview/images/white_space.png');
/* images/white_space.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
background-position: center center;
}
.token_tab {
background-image: url('/examples/textview/images/white_tab.png');
/* images/white_tab.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: left center;
}
.line_caret {
background-color: #EAF2FE;
}/* Styling for html syntax highlighting */
}
/* Styling for html syntax highlighting */
.entity-name-tag {
color: #3f7f7f;
}
@ -112,4 +138,4 @@
.invalid {
color: red;
font-weight: bold;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -57,7 +57,8 @@ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
* SourceEditor.THEMES to Orion CSS files.
*/
const ORION_THEMES = {
textmate: "chrome://browser/content/orion.css",
textmate: ["chrome://browser/content/orion.css",
"chrome://browser/content/orion-mozilla.css"],
};
/**
@ -196,9 +197,9 @@ SourceEditor.prototype = {
});
if (config.showLineNumbers) {
this._lines_ruler = new textview.LineNumberRuler("left",
{styleClass: "ruler_lines", style: {minWidth: "1.4em"}},
{styleClass: "ruler_lines_even"}, {styleClass: "ruler_lines_even"});
this._lines_ruler = new textview.LineNumberRuler(null, "left",
{styleClass: "rulerLines"}, {styleClass: "rulerLine odd"},
{styleClass: "rulerLine even"});
this._view.addRuler(this._lines_ruler);
}
@ -390,7 +391,7 @@ SourceEditor.prototype = {
let model = this._model;
let lineIndex = model.getLineAtOffset(selection.start);
let lineText = model.getLine(lineIndex);
let lineText = model.getLine(lineIndex, true);
let lineStart = model.getLineStart(lineIndex);
let index = 0;
let lineOffset = selection.start - lineStart;

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

@ -145,35 +145,10 @@ function editorLoaded()
is(editor.getCaretOffset(), 8, "caret moved to the left");
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
is(editor.getSelectedText(), "code-ed.aitor",
"select all worked");
EventUtils.synthesizeKey("x", {accelKey: true}, testWin);
ok(!editor.getText(), "cut works");
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
is(editor.getText(), "code-ed.aitorcode-ed.aitor", "paste works");
editor.setText("foo");
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
EventUtils.synthesizeKey("c", {accelKey: true}, testWin);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
is(editor.getText(), "foofoo", "ctrl-a, c, v, v works");
is(editor.getCaretOffset(), 6, "caret location is correct");
EventUtils.synthesizeKey(".", {}, testWin);
EventUtils.synthesizeKey("VK_TAB", {}, testWin);
is(editor.getText(), "foofoo. ", "Tab works");
is(editor.getText(), "code-ed.. aitor", "Tab works");
is(editor.getCaretOffset(), 14, "caret location is correct");
@ -276,24 +251,8 @@ function editorLoaded()
is(event.removedCharCount, 0, "event.removedCharCount is correct");
is(event.addedCharCount, 1, "event.addedCharCount is correct");
let chars = editor.getText().length;
event = null;
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
EventUtils.synthesizeKey("c", {accelKey: true}, testWin);
editor.setCaretOffset(chars);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
ok(event, "the TextChanged event fired after paste");
is(event.start, chars, "event.start is correct");
is(event.removedCharCount, 0, "event.removedCharCount is correct");
is(event.addedCharCount, chars, "event.addedCharCount is correct");
editor.setText("line1\nline2\nline3");
chars = editor.getText().length;
let chars = editor.getText().length;
event = null;
editor.setText("a\nline4\nline5", chars);
@ -303,6 +262,7 @@ function editorLoaded()
is(event.removedCharCount, 0, "event.removedCharCount is correct");
is(event.addedCharCount, 13, "event.addedCharCount is correct");
event = null;
editor.setText("line3b\nline4b\nfoo", 12, 24);
ok(event, "the TextChanged event fired after setText() again");
@ -312,8 +272,11 @@ function editorLoaded()
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, eventHandler);
// Done.
testClipboardEvents();
}
function testEnd()
{
editor.destroy();
ok(!editor.parentElement && !editor.editorElement, "destroy() works");
@ -361,3 +324,75 @@ function testReturnKey()
"return maintains indentation (again)");
}
function testClipboardEvents()
{
editor.setText("foobar");
let doCut = function() {
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
is(editor.getSelectedText(), "foobar", "select all worked");
EventUtils.synthesizeKey("x", {accelKey: true}, testWin);
};
let onCut = function() {
ok(!editor.getText(), "cut works");
editor.setText("test--");
editor.setCaretOffset(5);
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
};
let onPaste1 = function() {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
is(editor.getText(), "test-foobar-", "paste works");
executeSoon(waitForClipboard.bind(this, "test", doCopy, onCopy, testEnd));
};
let doCopy = function() {
editor.setSelection(0, 4);
EventUtils.synthesizeKey("c", {accelKey: true}, testWin);
};
let onCopy = function() {
editor.setSelection(5, 11);
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
};
let pasteTextChanges = 0;
let removedCharCount = 0;
let addedCharCount = 0;
let onPaste2 = function(aEvent) {
pasteTextChanges++;
ok(aEvent && (pasteTextChanges == 1 || pasteTextChanges == 2),
"event TEXT_CHANGED fired " + pasteTextChanges + " time(s)");
is(aEvent.start, 5, "event.start is correct");
if (aEvent.removedCharCount) {
removedCharCount = aEvent.removedCharCount;
}
if (aEvent.addedCharCount) {
addedCharCount = aEvent.addedCharCount;
}
if (pasteTextChanges == 2 || addedCharCount && removedCharCount) {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
executeSoon(checkPaste2Result);
}
};
let checkPaste2Result = function() {
is(removedCharCount, 6, "event.removedCharCount is correct");
is(addedCharCount, 4, "event.addedCharCount is correct");
is(editor.getText(), "test-test-", "paste works after copy");
testEnd();
};
waitForClipboard("foobar", doCut, onCut, testEnd);
}

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

@ -0,0 +1,178 @@
/* ***** 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 GCLI Commands.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Walker <jwalker@mozilla.com> (original author)
*
* 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 ***** */
let EXPORTED_SYMBOLS = [ "GcliCommands" ];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/gcli.jsm");
Components.utils.import("resource:///modules/HUDService.jsm");
let bundleName = "chrome://browser/locale/devtools/gclicommands.properties";
let stringBundle = Services.strings.createBundle(bundleName);
let gcli = gcli._internal.require("gcli/index");
let canon = gcli._internal.require("gcli/canon");
let document;
/**
* The exported API
*/
let GcliCommands = {
/**
* Allow HUDService to inform us of the document against which we work
*/
setDocument: function GcliCommands_setDocument(aDocument) {
document = aDocument;
},
/**
* Undo the effects of GcliCommands.setDocument()
*/
unsetDocument: function GcliCommands_unsetDocument() {
document = undefined;
}
};
/**
* Lookup a string in the GCLI string bundle
* @param aName The name to lookup
* @return The looked up name
*/
function lookup(aName)
{
try {
return stringBundle.GetStringFromName(aName);
} catch (ex) {
throw new Error("Failure in lookup('" + aName + "')");
}
};
/**
* Lookup a string in the GCLI string bundle
* @param aName The name to lookup
* @param aSwaps An array of swaps. See stringBundle.formatStringFromName
* @return The looked up name
*/
function lookupFormat(aName, aSwaps)
{
try {
return stringBundle.formatStringFromName(aName, aSwaps, aSwaps.length);
} catch (ex) {
Services.console.logStringMessage("Failure in lookupFormat('" + aName + "')");
throw new Error("Failure in lookupFormat('" + aName + "')");
}
}
/**
* 'echo' command
*/
gcli.addCommand({
name: "echo",
description: lookup("echoDesc"),
params: [
{
name: "message",
type: "string",
description: lookup("echoMessageDesc")
}
],
returnType: "string",
exec: function Command_echo(args, context) {
return args.message;
}
});
/**
* 'help' command
*/
gcli.addCommand({
name: "help",
returnType: "html",
description: lookup("helpDesc"),
exec: function Command_help(args, context) {
let output = [];
output.push("<strong>" + lookup("helpAvailable") + ":</strong><br/>");
let commandNames = canon.getCommandNames();
commandNames.sort();
output.push("<table>");
for (let i = 0; i < commandNames.length; i++) {
let command = canon.getCommand(commandNames[i]);
if (!command.hidden && command.description) {
output.push("<tr>");
output.push('<th class="gcliCmdHelpRight">' + command.name + "</th>");
output.push("<td>&#x2192; " + command.description + "</td>");
output.push("</tr>");
}
}
output.push("</table>");
return output.join("");
}
});
/**
* 'console' command
*/
gcli.addCommand({
name: "console",
description: lookup("consoleDesc"),
manual: lookup("consoleManual")
});
/**
* 'console clear' command
*/
gcli.addCommand({
name: "console clear",
description: lookup("consoleclearDesc"),
exec: function(args, context) {
let hud = HUDService.getHudReferenceById(context.environment.hudId);
hud.gcliterm.clearOutput();
}
});

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

@ -28,6 +28,7 @@
* Julian Viereck <jviereck@mozilla.com>
* Mihai Șucan <mihai.sucan@gmail.com>
* Michael Ratcliffe <mratcliffe@mozilla.com>
* Joe Walker <jwalker@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
@ -72,6 +73,18 @@ XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
"@mozilla.org/widget/clipboardhelper;1",
"nsIClipboardHelper");
XPCOMUtils.defineLazyGetter(this, "gcli", function () {
var obj = {};
Cu.import("resource:///modules/gcli.jsm", obj);
return obj.gcli;
});
XPCOMUtils.defineLazyGetter(this, "GcliCommands", function () {
var obj = {};
Cu.import("resource:///modules/GcliCommands.jsm", obj);
return obj.GcliCommands;
});
XPCOMUtils.defineLazyGetter(this, "StyleInspector", function () {
var obj = {};
Cu.import("resource:///modules/devtools/StyleInspector.jsm", obj);
@ -1481,6 +1494,24 @@ HUD_SERVICE.prototype =
if (!aAnimated || hudRef.consolePanel) {
this.disableAnimation(hudId);
}
// Create a processing instruction for GCLIs CSS stylesheet, but only if
// we don't have one for this document. Also record the context we're
// adding this for so we know when to remove it.
let procInstr = aContext.ownerDocument.gcliCssProcInstr;
if (!procInstr) {
procInstr = aContext.ownerDocument.createProcessingInstruction(
"xml-stylesheet",
"href='chrome://browser/skin/devtools/gcli.css' type='text/css'");
procInstr.contexts = [];
let root = aContext.ownerDocument.getElementsByTagName('window')[0];
root.parentNode.insertBefore(procInstr, root);
aContext.ownerDocument.gcliCssProcInstr = procInstr;
}
if (procInstr.contexts.indexOf(hudId) == -1) {
procInstr.contexts.push(hudId);
}
},
/**
@ -1512,6 +1543,20 @@ HUD_SERVICE.prototype =
window.focus();
}
// Remove this context from the list of contexts that need the GCLI CSS
// processing instruction and then remove the processing instruction if it
// isn't needed any more.
let procInstr = aContext.ownerDocument.gcliCssProcInstr;
if (procInstr) {
procInstr.contexts = procInstr.contexts.filter(function(id) {
return id !== hudId;
});
if (procInstr.contexts.length == 0 && procInstr.parentNode) {
procInstr.parentNode.removeChild(procInstr);
delete aContext.ownerDocument.gcliCssProcInstr;
}
}
},
/**
@ -1750,7 +1795,12 @@ HUD_SERVICE.prototype =
// Remove children from the output. If the output is not cleared, there can
// be leaks as some nodes has node.onclick = function; set and GC can't
// remove the nodes then.
hud.jsterm.clearOutput();
if (hud.jsterm) {
hud.jsterm.clearOutput();
}
if (hud.gcliterm) {
hud.gcliterm.clearOutput();
}
hud.destroy();
@ -1769,7 +1819,9 @@ HUD_SERVICE.prototype =
hud.splitter.parentNode.removeChild(hud.splitter);
}
hud.jsterm.autocompletePopup.destroy();
if (hud.jsterm) {
hud.jsterm.autocompletePopup.destroy();
}
delete this.hudReferences[aHUDId];
@ -3091,7 +3143,12 @@ function HeadsUpDisplay(aConfig)
// create the JSTerm input element
try {
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
this.jsterm.inputNode.focus();
if (this.jsterm) {
this.jsterm.inputNode.focus();
}
if (this.gcliterm) {
this.gcliterm.inputNode.focus();
}
}
catch (ex) {
Cu.reportError(ex);
@ -3212,6 +3269,9 @@ HeadsUpDisplay.prototype = {
if (this.jsterm) {
this.jsterm.inputNode.focus();
}
if (this.gcliterm) {
this.gcliterm.inputNode.focus();
}
}).bind(this);
panel.addEventListener("popupshown", onPopupShown,false);
@ -3403,6 +3463,9 @@ HeadsUpDisplay.prototype = {
if (this.jsterm) {
this.jsterm.inputNode.focus();
}
if (this.gcliterm) {
this.gcliterm.inputNode.focus();
}
},
/**
@ -3434,6 +3497,11 @@ HeadsUpDisplay.prototype = {
*/
jsterm: null,
/**
* The GcliTerm object that contains the console's GCLI
*/
gcliterm: null,
/**
* creates and attaches the console input node
*
@ -3443,12 +3511,24 @@ HeadsUpDisplay.prototype = {
createConsoleInput:
function HUD_createConsoleInput(aWindow, aParentNode, aExistingConsole)
{
var context = Cu.getWeakReference(aWindow);
let usegcli = false;
try {
usegcli = Services.prefs.getBoolPref("devtools.gcli.enable");
}
catch (ex) {}
if (appName() == "FIREFOX") {
let mixin = new JSTermFirefoxMixin(context, aParentNode,
aExistingConsole);
this.jsterm = new JSTerm(context, aParentNode, mixin, this.console);
if (!usegcli) {
let context = Cu.getWeakReference(aWindow);
let mixin = new JSTermFirefoxMixin(context, aParentNode,
aExistingConsole);
this.jsterm = new JSTerm(context, aParentNode, mixin, this.console);
}
else {
this.gcliterm = new GcliTerm(aWindow, this.hudId, this.chromeDocument,
this.console, this.hintNode);
aParentNode.appendChild(this.gcliterm.element);
}
}
else {
throw new Error("Unsupported Gecko Application");
@ -3471,14 +3551,17 @@ HeadsUpDisplay.prototype = {
this.consolePanel.label = this.getPanelTitle();
}
if (!this.jsterm) {
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
}
else {
if (this.jsterm) {
this.jsterm.context = Cu.getWeakReference(this.contentWindow);
this.jsterm.console = this.console;
this.jsterm.createSandbox();
}
else if (this.gcliterm) {
this.gcliterm.reattachConsole(this.contentWindow, this.console);
}
else {
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
}
},
/**
@ -3522,14 +3605,6 @@ HeadsUpDisplay.prototype = {
consoleWrap.setAttribute("class", "hud-console-wrapper");
consoleWrap.setAttribute("flex", "1");
this.outputNode = this.makeXULNode("richlistbox");
this.outputNode.setAttribute("class", "hud-output-node");
this.outputNode.setAttribute("flex", "1");
this.outputNode.setAttribute("orient", "vertical");
this.outputNode.setAttribute("context", this.hudId + "-output-contextmenu");
this.outputNode.setAttribute("style", "direction: ltr;");
this.outputNode.setAttribute("seltype", "multiple");
this.filterSpacer = this.makeXULNode("spacer");
this.filterSpacer.setAttribute("flex", "1");
@ -3548,9 +3623,36 @@ HeadsUpDisplay.prototype = {
let consoleFilterToolbar = this.makeFilterToolbar();
consoleFilterToolbar.setAttribute("id", "viewGroup");
this.consoleFilterToolbar = consoleFilterToolbar;
consoleWrap.appendChild(consoleFilterToolbar);
consoleWrap.appendChild(this.outputNode);
let hintSpacerNode = this.makeXULNode("box");
hintSpacerNode.setAttribute("flex", 1);
this.hintNode = this.makeXULNode("div");
this.hintNode.setAttribute("class", "gcliterm-hint-node");
let hintParentNode = this.makeXULNode("vbox");
hintParentNode.setAttribute("flex", "0");
hintParentNode.setAttribute("class", "gcliterm-hint-parent");
hintParentNode.appendChild(hintSpacerNode);
hintParentNode.appendChild(this.hintNode);
hintParentNode.hidden = true;
let hbox = this.makeXULNode("hbox");
hbox.setAttribute("flex", "1");
this.outputNode = this.makeXULNode("richlistbox");
this.outputNode.setAttribute("class", "hud-output-node");
this.outputNode.setAttribute("flex", "1");
this.outputNode.setAttribute("orient", "vertical");
this.outputNode.setAttribute("context", this.hudId + "-output-contextmenu");
this.outputNode.setAttribute("style", "direction: ltr;");
this.outputNode.setAttribute("seltype", "multiple");
hbox.appendChild(hintParentNode);
hbox.appendChild(this.outputNode);
consoleWrap.appendChild(consoleFilterToolbar);
consoleWrap.appendChild(hbox);
outerWrap.appendChild(consoleWrap);
@ -3865,7 +3967,13 @@ HeadsUpDisplay.prototype = {
{
let hudId = this.hudId;
function HUD_clearButton_onCommand() {
HUDService.getHudReferenceById(hudId).jsterm.clearOutput();
let hud = HUDService.getHudReferenceById(hudId);
if (hud.jsterm) {
hud.jsterm.clearOutput();
}
if (hud.gcliterm) {
hud.gcliterm.clearOutput();
}
}
let clearButton = this.makeXULNode("toolbarbutton");
@ -3936,7 +4044,12 @@ HeadsUpDisplay.prototype = {
*/
destroy: function HUD_destroy()
{
this.jsterm.destroy();
if (this.jsterm) {
this.jsterm.destroy();
}
if (this.gcliterm) {
this.gcliterm.destroy();
}
this.positionMenuitems.above.removeEventListener("command",
this._positionConsoleAbove, false);
@ -5431,6 +5544,7 @@ JSTermFirefoxMixin.prototype = {
this.completeNode.setAttribute("class", "jsterm-complete-node");
this.completeNode.setAttribute("multiline", "true");
this.completeNode.setAttribute("rows", "1");
this.completeNode.setAttribute("tabindex", "-1");
this.inputNode = this.xulElementFactory("textbox");
this.inputNode.setAttribute("class", "jsterm-input-node");
@ -5444,22 +5558,15 @@ JSTermFirefoxMixin.prototype = {
inputStack.appendChild(this.inputNode);
if (this.existingConsoleNode == undefined) {
this.outputNode = this.xulElementFactory("vbox");
this.outputNode.setAttribute("class", "jsterm-output-node");
this.term = this.xulElementFactory("vbox");
this.term.setAttribute("class", "jsterm-wrapper-node");
this.term.setAttribute("flex", "1");
this.term.appendChild(this.outputNode);
throw new Error("This can't happen");
}
else {
this.outputNode = this.existingConsoleNode;
this.term = this.xulElementFactory("hbox");
this.term.setAttribute("class", "jsterm-input-container");
this.term.setAttribute("style", "direction: ltr;");
this.term.appendChild(inputStack);
}
this.outputNode = this.existingConsoleNode;
this.term = this.xulElementFactory("hbox");
this.term.setAttribute("class", "jsterm-input-container");
this.term.setAttribute("style", "direction: ltr;");
this.term.appendChild(inputStack);
},
get inputValue()
@ -5591,9 +5698,8 @@ ConsoleUtils = {
function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
aBody, aHUDId, aSourceURL,
aSourceLine, aClipboardText, aLevel) {
if (aBody instanceof Ci.nsIDOMNode && aClipboardText == null) {
throw new Error("HUDService.createMessageNode(): DOM node supplied " +
"without any clipboard text");
if (typeof aBody != "string" && aClipboardText == null && aBody.innerText) {
aClipboardText = aBody.innerText;
}
// Make the icon container, which is a vertical box. Its purpose is to
@ -5632,6 +5738,13 @@ ConsoleUtils = {
aBody = aBody instanceof Ci.nsIDOMNode && !(aLevel == "dir") ?
aBody : aDocument.createTextNode(aBody);
if (!aBody.nodeType) {
aBody = aDocument.createTextNode(aBody.toString());
}
if (typeof aBody == "string") {
aBody = aDocument.createTextNode(aBody);
}
bodyNode.appendChild(aBody);
let repeatContainer = aDocument.createElementNS(XUL_NS, "hbox");
@ -6761,3 +6874,235 @@ catch (ex) {
// TODO: kill anything that may have started up
// see bug 568665
}
///////////////////////////////////////////////////////////////////////////
// GcliTerm
///////////////////////////////////////////////////////////////////////////
/**
* GcliTerm
*
* Initialize GCLI by creating a set of startup options from the available
* properties.
*
* @param nsIDOMWindow aContentWindow
* The content window that we're providing as the context to commands
* @param string aHudId
* The HUD to which we should send console messages.
* @param nsIDOMDocument aDocument
* The DOM document from which to create nodes.
* @param object aConsole
* Console object to use within the GcliTerm.
* @param nsIDOMElement aHintNode
* The node to which we add GCLI's hints.
* @constructor
*/
function GcliTerm(aContentWindow, aHudId, aDocument, aConsole, aHintNode)
{
this.context = Cu.getWeakReference(aContentWindow);
this.hudId = aHudId;
this.document = aDocument;
this.console = aConsole;
this.hintNode = aHintNode;
this.createUI();
this.createSandbox();
this.show = this.show.bind(this);
this.hide = this.hide.bind(this);
this.opts = {
environment: { hudId: this.hudId },
chromeDocument: this.document,
contentDocument: aContentWindow.document,
jsEnvironment: {
globalObject: aContentWindow,
evalFunction: this.evalInSandbox.bind(this)
},
inputElement: this.inputNode,
completeElement: this.completeNode,
inputBackgroundElement: this.inputStack,
hintElement: this.hintNode,
completionPrompt: "",
gcliTerm: this
};
gcli._internal.commandOutputManager.addListener(this.onCommandOutput, this);
gcli._internal.createView(this.opts);
GcliCommands.setDocument(aContentWindow.document);
}
GcliTerm.prototype = {
/**
* Remove the hint column from the display.
*/
hide: function GcliTerm_hide()
{
this.hintNode.parentNode.hidden = true;
},
/**
* Undo the effects of calling hide().
*/
show: function GcliTerm_show()
{
this.hintNode.parentNode.hidden = false;
},
/**
* Destroy the GcliTerm object. Call this method to avoid memory leaks.
*/
destroy: function Gcli_destroy()
{
GcliCommands.unsetDocument();
gcli._internal.removeView(this.opts);
gcli._internal.commandOutputManager.removeListener(this.onCommandOutput, this);
delete this.opts.chromeDocument;
delete this.opts.inputElement;
delete this.opts.completeElement;
delete this.opts.inputBackgroundElement;
delete this.opts.hintElement;
delete this.opts.contentDocument;
delete this.opts.jsEnvironment;
delete this.opts.gcliTerm;
delete this.context;
delete this.document;
delete this.console;
delete this.hintNode;
delete this.sandbox;
delete this.element
delete this.inputStack
delete this.completeNode
delete this.inputNode
},
/**
* Re-attaches a console when the contentWindow is recreated.
*
* @param nsIDOMWindow aContentWindow
* The content window that we're providing as the context to commands
* @param object aConsole
* Console object to use within the GcliTerm.
*/
reattachConsole: function Gcli_reattachConsole(aContentWindow, aConsole)
{
this.context = Cu.getWeakReference(aContentWindow);
this.console = aConsole;
this.createSandbox();
},
/**
* Generates and attaches the GCLI Terminal part of the Web Console, which
* essentially consists of the interactive JavaScript input facility.
*/
createUI: function Gcli_createUI()
{
this.element = this.document.createElement("vbox");
this.element.setAttribute("class", "gcliterm-input-container");
this.element.setAttribute("flex", "0");
this.inputStack = this.document.createElement("stack");
this.inputStack.setAttribute("class", "gcliterm-stack-node");
this.element.appendChild(this.inputStack);
this.completeNode = this.document.createElement("div");
this.completeNode.setAttribute("class", "gcliterm-complete-node");
this.completeNode.setAttribute("aria-live", "polite");
this.inputStack.appendChild(this.completeNode);
this.inputNode = this.document.createElement("textbox");
this.inputNode.setAttribute("class", "gcliterm-input-node");
this.inputNode.setAttribute("rows", "1");
this.inputStack.appendChild(this.inputNode);
},
/**
* Called by GCLI/canon when command line output changes.
*/
onCommandOutput: function Gcli_onCommandOutput(aEvent)
{
// When we can update the history of the console, then we should stop
// filtering incomplete reports.
if (!aEvent.output.completed) {
return;
}
this.writeOutput(aEvent.output.typed, { category: CATEGORY_INPUT });
if (aEvent.output.output == null) {
return;
}
let output = aEvent.output.output;
if (aEvent.output.command.returnType == "html" && typeof output == "string") {
let frag = this.document.createRange().createContextualFragment(
'<div xmlns="' + HTML_NS + '" xmlns:xul="' + XUL_NS + '">' +
output + '</div>');
output = this.document.createElementNS(HTML_NS, "div");
output.appendChild(frag);
}
this.writeOutput(output);
},
/**
* Setup the eval sandbox, should be called whenever we are attached.
*/
createSandbox: function Gcli_createSandbox()
{
let win = this.context.get().QueryInterface(Ci.nsIDOMWindow);
// create a JS Sandbox out of this.context
this.sandbox = new Cu.Sandbox(win, {
sandboxPrototype: win,
wantXrays: false
});
this.sandbox.console = this.console;
},
/**
* Evaluates a string in the sandbox.
*
* @param string aString
* String to evaluate in the sandbox
* @return The result of the evaluation
*/
evalInSandbox: function Gcli_evalInSandbox(aString)
{
return Cu.evalInSandbox(aString, this.sandbox, "1.8", "Web Console", 1);
},
/**
* Writes a message to the HUD that originates from the interactive
* JavaScript console.
*
* @param string aOutputMessage
* The message to display.
* @param number aCategory
* One of the CATEGORY_ constants.
* @param number aSeverity
* One of the SEVERITY_ constants.
*/
writeOutput: function Gcli_writeOutput(aOutputMessage, aOptions)
{
aOptions = aOptions || {};
let node = ConsoleUtils.createMessageNode(
this.document,
aOptions.category || CATEGORY_OUTPUT,
aOptions.severity || SEVERITY_LOG,
aOutputMessage,
this.hudId,
aOptions.sourceUrl || undefined,
aOptions.sourceLine || undefined,
aOptions.clipboardText || undefined);
ConsoleUtils.outputMessageNode(node, this.hudId);
},
clearOutput: JSTerm.prototype.clearOutput,
};

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

@ -49,6 +49,7 @@ EXTRA_JS_MODULES = \
NetworkHelper.jsm \
AutocompletePopup.jsm \
gcli.jsm \
GcliCommands.jsm \
$(NULL)
EXTRA_PP_JS_MODULES = \

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -108,7 +108,6 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_600183_charset.js \
browser_webconsole_bug_601177_log_levels.js \
browser_webconsole_bug_597460_filter_scroll.js \
browser_webconsole_gcli_require.js \
browser_webconsole_console_extras.js \
browser_webconsole_bug_598357_jsterm_output.js \
browser_webconsole_bug_603750_websocket.js \
@ -146,6 +145,9 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_659907_console_dir.js \
browser_webconsole_bug_678816.js \
browser_webconsole_bug_664131_console_group.js \
browser_gcli_require.js \
browser_gcli_integrate.js \
browser_gcli_web.js \
head.js \
$(NULL)

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

@ -0,0 +1,103 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// For more information on GCLI see:
// - https://github.com/mozilla/gcli/blob/master/docs/index.md
// - https://wiki.mozilla.org/DevTools/Features/GCLI
// Tests that source URLs in the Web Console can be clicked to display the
// standard View Source window.
Components.utils.import("resource:///modules/gcli.jsm");
let require = gcli._internal.require;
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
registerCleanupFunction(function() {
require = undefined;
Services.prefs.clearUserPref("devtools.gcli.enable");
});
function test() {
Services.prefs.setBoolPref("devtools.gcli.enable", true);
addTab(TEST_URI);
browser.addEventListener("DOMContentLoaded", onLoad, false);
}
function onLoad() {
browser.removeEventListener("DOMContentLoaded", onLoad, false);
try {
openConsole();
testCreateCommands();
testCallCommands();
testRemoveCommands();
}
catch (ex) {
gcli._internal.console.error('Test Failure', ex);
}
finally {
closeConsole();
finishTest();
}
}
let tselarr = {
name: 'tselarr',
params: [
{ name: 'num', type: { name: 'selection', data: [ '1', '2', '3' ] } },
{ name: 'arr', type: { name: 'array', subtype: 'string' } },
],
exec: function(args, env) {
return "flu " + args.num + "-" + args.arr.join("_");
}
};
function testCreateCommands() {
let gcli = require("gcli/index");
gcli.addCommand(tselarr);
let canon = require("gcli/canon");
let tselcmd = canon.getCommand("tselarr");
ok(tselcmd != null, "tselarr exists in the canon");
ok(tselcmd instanceof canon.Command, "canon storing commands");
}
function testCallCommands() {
let hud = HUDService.getHudByWindow(content);
let gcliterm = hud.gcliterm;
ok(gcliterm, "We have a GCLI term");
// Test successful auto-completion
gcliterm.inputNode.value = "h";
gcliterm.inputNode.focus();
EventUtils.synthesizeKey("e", {});
is(gcliterm.completeNode.textContent, " help", "Completion for \"he\"");
// Test unsuccessful auto-completion
gcliterm.inputNode.value = "ec";
gcliterm.inputNode.focus();
EventUtils.synthesizeKey("d", {});
is(gcliterm.completeNode.textContent, " ecd", "Completion for \"ecd\"");
// Test a normal command's life cycle
gcliterm.opts.inputter.setInput("echo hello world");
gcliterm.opts.requisition.exec();
let nodes = hud.outputNode.querySelectorAll("description");
is(nodes.length, 2, "Right number of output nodes");
ok(/hello world/.test(nodes[0].textContent), "the command's output is correct.");
gcliterm.clearOutput();
}
function testRemoveCommands() {
let gcli = require("gcli/index");
gcli.removeCommand(tselarr);
let canon = require("gcli/canon");
let tselcmd = canon.getCommand("tselarr");
ok(tselcmd == null, "tselcmd removed from the canon");
}

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

@ -1,6 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// For more information on GCLI see:
// - https://github.com/mozilla/gcli/blob/master/docs/index.md
// - https://wiki.mozilla.org/DevTools/Features/GCLI
// Tests that source URLs in the Web Console can be clicked to display the
// standard View Source window.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -50,50 +50,51 @@ const TESTS = [
matchString: "fooBarSVG",
},
{ // #7
file: "test-bug-595934-workers.html",
category: "Web Worker",
matchString: "fooBarWorker",
},
{ // #8
file: "test-bug-595934-dom-html-external.html",
category: "DOM:HTML",
matchString: "document.all",
},
{ // #9
{ // #8
file: "test-bug-595934-dom-events-external2.html",
category: "DOM Events",
matchString: "preventBubble()",
},
{ // #10
{ // #9
file: "test-bug-595934-canvas.html",
category: "Canvas",
matchString: "strokeStyle",
},
{ // #11
{ // #10
file: "test-bug-595934-css-parser.html",
category: "CSS Parser",
matchString: "foobarCssParser",
},
{ // #12
{ // #11
file: "test-bug-595934-malformedxml-external.html",
category: "malformed-xml",
matchString: "</html>",
},
{ // #13
{ // #12
file: "test-bug-595934-empty-getelementbyid.html",
category: "DOM",
matchString: "getElementById",
},
{ // #14
{ // #13
file: "test-bug-595934-canvas-css.html",
category: "CSS Parser",
matchString: "foobarCanvasCssParser",
},
{ // #16
{ // #14
file: "test-bug-595934-image.html",
category: "Image",
matchString: "corrupt",
},
/* Disabled until bug 675221 lands.
{ // #7
file: "test-bug-595934-workers.html",
category: "Web Worker",
matchString: "fooBarWorker",
},*/
];
let pos = -1;

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

@ -0,0 +1,92 @@
# LOCALIZATION NOTE These strings are used inside the Web Console
# command line which is available from the Web Developer sub-menu
# -> 'Web Console'.
# The correct localization of this file might be to keep it in
# English, or another language commonly spoken among web developers.
# You want to make that choice consistent across the developer tools.
# A good criteria is the language in which you'd find the best
# documentation on web development on the web.
# LOCALIZATION NOTE (canonDescNone): Short string used to describe any command
# or command parameter when no description has been provided.
canonDescNone=(No description)
# LOCALIZATION NOTE (cliEvalJavascript): The special '{' command allows entry
# of JavaScript like traditional developer tool command lines. This describes
# the '{' command.
cliEvalJavascript=Enter JavaScript directly
# LOCALIZATION NOTE (fieldSelectionSelect): When a command has a parameter
# that has a number of pre-defined options the user interface presents these
# in a drop-down menu, where the first 'option' is an indicator that a
# selection should be made. This string describes that first option.
fieldSelectionSelect=Select a %S ...
# LOCALIZATION NOTE (fieldArrayAdd): When a command has a parameter that can
# be repeated a number of times (e.g. like the 'cat a.txt b.txt' command) the
# user interface presents buttons to add and remove arguments. This string is
# used to add arguments.
fieldArrayAdd=Add
# LOCALIZATION NOTE (fieldArrayDel): When a command has a parameter that can
# be repeated a number of times (e.g. like the 'cat a.txt b.txt' command) the
# user interface presents buttons to add and remove arguments. This string is
# used to remove arguments.
fieldArrayDel=Delete
# LOCALIZATION NOTE (jstypeParseScope): The command line provides completion
# for JavaScript commands, however there are times when the scope of what
# we're completing against can't be used. This error message is displayed when
# this happens.
jstypeParseScope=Scope lost
# LOCALIZATION NOTE (jstypeParseMissing): When the command line is doing
# JavaScript completion, sometimes the property to be completed does not
# exist. This error message is displayed when this happens.
jstypeParseMissing=Can't find property '%S'
# LOCALIZATION NOTE (jstypeBeginSyntax): When the command line is doing
# JavaScript completion using invalid JavaScript, this error message is
# displayed.
jstypeBeginSyntax=Syntax error
# LOCALIZATION NOTE (jstypeBeginUnterm): When the command line is doing
# JavaScript completion using a string that is not properly terminated, this
# error message is displayed.
jstypeBeginUnterm=Unterminated string literal
# LOCALIZATION NOTE (typesNumberNan): When the command line is passed a
# number, however the input string is not a valid number, this error message
# is displayed.
typesNumberNan=Can't convert "%S" to a number.
# LOCALIZATION NOTE (typesNumberMax): When the command line is passed a
# number, but the number is bigger than the largest allowed number, this error
# message is displayed.
typesNumberMax=%1$S is greater that maximum allowed: %2$S.
# LOCALIZATION NOTE (typesNumberMin): When the command line is passed a
# number, but the number is lower than the smallest allowed number, this error
# message is displayed.
typesNumberMin=%1$S is smaller that minimum allowed: %2$S.
# LOCALIZATION NOTE (typesSelectionNomatch): When the command line is passed
# an option with a limited number of correct values, but the passed value is
# not one of them, this error message is displayed.
typesSelectionNomatch=Can't use '%S'.
# LOCALIZATION NOTE (nodeParseSyntax): When the command line is expecting a
# CSS query string, however the passed string is not valid, this error message
# is displayed.
nodeParseSyntax=Syntax error in CSS query
# LOCALIZATION NOTE (nodeParseMultiple): When the command line is expecting a
# CSS string that matches a single node, but more than one node matches, this
# error message is displayed.
nodeParseMultiple=Too many matches (%S)
# LOCALIZATION NOTE (nodeParseNone): When the command line is expecting a CSS
# string that matches a single node, but no nodes match, this error message is
# displayed.
nodeParseNone=No matches

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

@ -0,0 +1,37 @@
# LOCALIZATION NOTE These strings are used inside Web Console commands.
# The Web Console command line is available from the Web Developer sub-menu
# -> 'Web Console'.
#
# The correct localization of this file might be to keep it in
# English, or another language commonly spoken among web developers.
# You want to make that choice consistent across the developer tools.
# A good criteria is the language in which you'd find the best
# documentation on web development on the web.
# LOCALIZATION NOTE (echoDesc) A very short string used to describe the
# function of the echo command.
echoDesc=Show a message
# LOCALIZATION NOTE (echoMessageDesc) A very short string used to describe the
# message parameter to the echo command.
echoMessageDesc=Message
# LOCALIZATION NOTE (helpDesc) A very short string used to describe the
# function of the help command.
helpDesc=Get help on the available commands
# LOCALIZATION NOTE (helpAvailable) Used in the output of the help command to
# explain the contents of the command help table.
helpAvailable=Available Commands
# LOCALIZATION NOTE (consoleDesc) A very short string used to describe the
# function of the console command.
consoleDesc=Commands to control the console
# LOCALIZATION NOTE (consoleManual) A longer description describing the
# set of commands that control the console.
consoleManual=Filter, clear and close the web console
# LOCALIZATION NOTE (consoleclearDesc) A very short string used to describe the
# function of the 'console clear' command.
consoleclearDesc=Clear the console

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

@ -40,8 +40,8 @@
<!ENTITY allowScripts.label "Allow scripts to:">
<!ENTITY moveResizeWindows.label "Move or resize existing windows">
<!ENTITY moveResizeWindows.accesskey "M">
<!ENTITY moveResizePopupWindows.label "Move or resize popup windows">
<!ENTITY moveResizePopupWindows.accesskey "M">
<!ENTITY raiseLowerWindows.label "Raise or lower windows">
<!ENTITY raiseLowerWindows.accesskey "R">
<!ENTITY disableContextMenus.label "Disable or replace context menus">

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

@ -58,23 +58,26 @@
<!ENTITY updateTab.label "Update">
<!ENTITY autoCheck.label "Automatically check for updates to:">
<!ENTITY enableAppUpdate.label "&brandShortName;">
<!ENTITY enableAppUpdate.accesskey "F">
<!ENTITY enableAddonsUpdate2.label "Add-ons">
<!ENTITY enableAddonsUpdate2.accesskey "n">
<!ENTITY enableSearchUpdate.label "Search Engines">
<!ENTITY enableSearchUpdate.accesskey "E">
<!ENTITY whenUpdatesFound.label "When updates to &brandShortName; are found:">
<!ENTITY askMe.label "Ask me what I want to do">
<!ENTITY askMe.accesskey "k">
<!ENTITY modeAutomatic.label "Automatically download and install the update">
<!ENTITY modeAutomatic.accesskey "d">
<!ENTITY modeAutoAddonWarn.label "Warn me if this will disable any of my add-ons">
<!ENTITY modeAutoAddonWarn.accesskey "W">
<!ENTITY updateApp.label "&brandShortName; updates:">
<!ENTITY updateAuto.label "Automatically install updates (recommended: improved security)">
<!ENTITY updateAuto.accesskey "A">
<!ENTITY updateCheck.label "Check for updates, but let me choose whether to install them">
<!ENTITY updateCheck.accesskey "C">
<!ENTITY updateManual.label "Never check for updates (not recommended: security risk)">
<!ENTITY updateManual.accesskey "N">
<!ENTITY updateAutoAddonWarn.label "Warn me if this will disable any of my add-ons">
<!ENTITY updateAutoAddonWarn.accesskey "W">
<!ENTITY updateHistory.label "Show Update History">
<!ENTITY updateHistory.accesskey "p">
<!ENTITY updateOthers.label "Automatically update:">
<!ENTITY enableAddonsUpdate3.label "Add-ons">
<!ENTITY enableAddonsUpdate3.accesskey "o">
<!ENTITY enableSearchUpdate.label "Search Engines">
<!ENTITY enableSearchUpdate.accesskey "E">
<!ENTITY offlineNotify.label "Tell me when a website asks to store data for offline use">
<!ENTITY offlineNotify.accesskey "T">
<!ENTITY offlineNotifyExceptions.label "Exceptions…">

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

@ -53,7 +53,7 @@
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY notCached.title "Document Expired">
<!ENTITY notCached.longDesc "<p>The requested document is not available in Firefox's cache.</p><ul><li>As a security precuation, Firefox does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
<!ENTITY notCached.longDesc "<p>The requested document is not available in Firefox's cache.</p><ul><li>As a security precaution, Firefox does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc2 "

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

@ -14,6 +14,8 @@
* locale/browser/browser.dtd (%chrome/browser/browser.dtd)
locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd)
locale/browser/browser.properties (%chrome/browser/browser.properties)
locale/browser/devtools/gcli.properties (%chrome/browser/devtools/gcli.properties)
locale/browser/devtools/gclicommands.properties (%chrome/browser/devtools/gclicommands.properties)
locale/browser/styleinspector.properties (%chrome/browser/styleinspector.properties)
locale/browser/styleinspector.dtd (%chrome/browser/styleinspector.dtd)
locale/browser/scratchpad.properties (%chrome/browser/scratchpad.properties)

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

@ -54,6 +54,9 @@
%filter substitution
%define toolbarHighlight rgba(255,255,255,.3)
%define selectedTabHighlight rgba(255,255,255,.8) 1px, rgba(255,255,255,.5) 3px
%define forwardTransitionLength 150ms
%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"][mode=icons], #nav-bar:not([currentset])[mode=icons]) > #unified-back-forward-button
%define conditionalForwardWithUrlbar_small window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"][mode=icons][iconsize=small],#nav-bar:not([currentset])[mode=icons][iconsize=small]) > #unified-back-forward-button
#menubar-items {
-moz-box-orient: vertical; /* for flex hack */
@ -602,36 +605,41 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=toolbar&state=disabled");
}
#forward-button {
#forward-button,
@conditionalForwardWithUrlbar@ > #forward-button {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar");
-moz-transition: 250ms ease-out;
}
#forward-button:-moz-locale-dir(rtl) {
#forward-button:-moz-locale-dir(rtl),
@conditionalForwardWithUrlbar@ > #forward-button:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar");
}
toolbar:not([mode=icons]) #forward-button[disabled="true"] {
#forward-button[disabled] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar&state=disabled");
}
toolbar:not([mode=icons]) #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
#forward-button[disabled]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar&state=disabled");
}
toolbar[mode=icons] #forward-button[disabled="true"] {
@conditionalForwardWithUrlbar@:not([switchingtabs]) > #forward-button {
-moz-transition: @forwardTransitionLength@ ease-out;
}
@conditionalForwardWithUrlbar@ > #forward-button[disabled] {
-moz-transform: scale(0);
opacity: 0;
pointer-events: none;
}
toolbar[mode=icons] #forward-button[disabled="true"]:-moz-locale-dir(ltr) {
@conditionalForwardWithUrlbar@ > #forward-button[disabled]:-moz-locale-dir(ltr) {
margin-left: -36px;
}
toolbar[mode=icons] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
@conditionalForwardWithUrlbar@ > #forward-button[disabled]:-moz-locale-dir(rtl) {
margin-right: -36px;
}
toolbar[mode=icons][iconsize=small] #forward-button[disabled="true"]:-moz-locale-dir(ltr) {
@conditionalForwardWithUrlbar_small@ > #forward-button[disabled]:-moz-locale-dir(ltr) {
margin-left: -28px;
}
toolbar[mode=icons][iconsize=small] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
@conditionalForwardWithUrlbar_small@ > #forward-button[disabled]:-moz-locale-dir(rtl) {
margin-right: -28px;
}
@ -800,23 +808,25 @@ toolbar[iconsize="small"] #back-button[disabled="true"]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=menu&state=disabled");
}
toolbar[iconsize="small"] #forward-button {
toolbar[iconsize=small] #forward-button,
@conditionalForwardWithUrlbar_small@ > #forward-button {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu");
}
.unified-nav-forward[_moz-menuactive] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu") !important;
}
toolbar[iconsize="small"]:not([mode=icons]) #forward-button[disabled="true"] {
toolbar[iconsize=small] #forward-button[disabled] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu&state=disabled");
}
toolbar[iconsize="small"] #forward-button:-moz-locale-dir(rtl) {
toolbar[iconsize=small] #forward-button:-moz-locale-dir(rtl),
@conditionalForwardWithUrlbar_small@ > #forward-button:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu");
}
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu") !important;
}
toolbar[iconsize="small"]:not([mode=icons]) #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
toolbar[iconsize=small] #forward-button[disabled]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu&state=disabled");
}

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

@ -0,0 +1,241 @@
/* ***** 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 GCLI.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Walker <jwalker@mozilla.com> (original author)
*
* 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 ***** */
/* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
.gcliterm-input-node,
.gcliterm-complete-node {
border: none;
-moz-appearance: none;
height: 100%;
vertical-align: middle;
background-color: transparent;
font: 12px Consolas, "Lucida Console", monospace;
padding: 2px 0 0 16px;
}
.gcliterm-complete-node {
color: #FFF;
padding: 4px 4px 2px 21px;
}
.gcliVALID {
border-bottom: none;
}
.gcliINCOMPLETE {
color: #DDD;
border-bottom: 1px dotted #999;
}
.gcliERROR {
color: #DDD;
border-bottom: 1px dotted #F00;
}
.gcliCompl {
color: #999;
}
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
}
.gcliterm-hint-node {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-bottom: 0px !important;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: auto;
padding: 10px;
}
.gcliterm-hint-parent {
border-bottom: 1px solid #AAA;
}
.gcliCmdHelpRight {
text-align: right;
}
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcliCmdDesc {
font-weight: bold;
text-align: center;
margin-bottom: 5px;
border-bottom: 1px solid #ddd;
padding-bottom: 3px;
}
.gcliParamGroup {
font-weight: bold;
}
.gcliParamName {
text-align: right;
font-size: 90%;
}
.gcliParamError {
font-size: 80%;
color: #900;
}
.gcliParamSubmit {
text-align: right;
}
.gcliGroupSymbol {
font-size: 90%;
color: #666;
}
.gcliRequired {
font-size: 80%;
color: #666;
}
.gcliParams {
width: 100%;
}
/* From: $GCLI/lib/gcli/ui/hinter.css */
.gcliHintParent {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: hidden;
}
.gcliHints {
overflow: auto;
padding: 10px;
display: inline-block;
}
.gcliHints ul {
margin: 0;
padding: 0 15px;
}
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcliOption {
overflow: hidden;
white-space: nowrap;
cursor: pointer;
padding: 2px;
}
.gcliOption:hover {
background-color: rgb(230, 230, 230);
}
.gcliOptionName {
padding-right: 5px;
}
.gcliOptionDesc {
font-size: 80%;
color: #999;
}
.gcliMenuError {
overflow: hidden;
white-space: nowrap;
padding: 8px 2px 2px 2px;
font-size: 80%;
color: red;
}
.gcliMenuField {
background-color: white;
color: black;
border: 1px solid #aaa;
padding: 2px;
max-height: 300px;
overflow-y: auto;
max-width: 220px;
overflow-x: hidden;
margin: 0px 10px;
border-top: 0px !important;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
}
/* From: $GCLI/lib/gcli/ui/inputter.css */
.gcliCompletion {
position: absolute;
z-index: -1000;
background-color: #DDD;
border: 1px transparent solid;
padding: 1px 1px 1px 2px;
}
.gcliCompletion {
color: #DDD;
}
.gcliINCOMPLETE {
border-bottom: 2px dotted #999;
}
.gcliERROR {
border-bottom: 2px dotted #F00;
}
.gcliPrompt {
color: #66F;
font-weight: bold;
}
.gcliCompl {
color: #999;
}
.gcliCloseBrace {
color: #999;
}

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

@ -332,30 +332,6 @@ html[dir=rtl] .undo .close {
opacity: 1.0;
}
/* InfoItems
----------------------------------*/
.info-item {
cursor: move;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(248,248,248,1);
border-radius: 0.4em;
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) 1px 1px 3px;
}
html[dir=rtl] .info-item {
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) -1px 1px 3px;
}
.intro {
margin: 10px;
}
/* Trenches
----------------------------------*/

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

@ -0,0 +1,241 @@
/* ***** 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 GCLI.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Walker <jwalker@mozilla.com> (original author)
*
* 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 ***** */
/* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
.gcliterm-input-node,
.gcliterm-complete-node {
border: none;
-moz-appearance: none;
height: 100%;
vertical-align: middle;
background-color: transparent;
font: 12px Consolas, "Lucida Console", monospace;
padding: 2px 0 0 16px;
}
.gcliterm-complete-node {
color: #FFF;
padding: 4px 4px 2px 21px;
}
.gcliVALID {
border-bottom: none;
}
.gcliINCOMPLETE {
color: #DDD;
border-bottom: 1px dotted #999;
}
.gcliERROR {
color: #DDD;
border-bottom: 1px dotted #F00;
}
.gcliCompl {
color: #999;
}
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
}
.gcliterm-hint-node {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-bottom: 0px !important;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: auto;
padding: 10px;
}
.gcliterm-hint-parent {
border-bottom: 1px solid #AAA;
}
.gcliCmdHelpRight {
text-align: right;
}
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcliCmdDesc {
font-weight: bold;
text-align: center;
margin-bottom: 5px;
border-bottom: 1px solid #ddd;
padding-bottom: 3px;
}
.gcliParamGroup {
font-weight: bold;
}
.gcliParamName {
text-align: right;
font-size: 90%;
}
.gcliParamError {
font-size: 80%;
color: #900;
}
.gcliParamSubmit {
text-align: right;
}
.gcliGroupSymbol {
font-size: 90%;
color: #666;
}
.gcliRequired {
font-size: 80%;
color: #666;
}
.gcliParams {
width: 100%;
}
/* From: $GCLI/lib/gcli/ui/hinter.css */
.gcliHintParent {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: hidden;
}
.gcliHints {
overflow: auto;
padding: 10px;
display: inline-block;
}
.gcliHints ul {
margin: 0;
padding: 0 15px;
}
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcliOption {
overflow: hidden;
white-space: nowrap;
cursor: pointer;
padding: 2px;
}
.gcliOption:hover {
background-color: rgb(230, 230, 230);
}
.gcliOptionName {
padding-right: 5px;
}
.gcliOptionDesc {
font-size: 80%;
color: #999;
}
.gcliMenuError {
overflow: hidden;
white-space: nowrap;
padding: 8px 2px 2px 2px;
font-size: 80%;
color: red;
}
.gcliMenuField {
background-color: white;
color: black;
border: 1px solid #aaa;
padding: 2px;
max-height: 300px;
overflow-y: auto;
max-width: 220px;
overflow-x: hidden;
margin: 0px 10px;
border-top: 0px !important;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
}
/* From: $GCLI/lib/gcli/ui/inputter.css */
.gcliCompletion {
position: absolute;
z-index: -1000;
background-color: #DDD;
border: 1px transparent solid;
padding: 1px 1px 1px 2px;
}
.gcliCompletion {
color: #DDD;
}
.gcliINCOMPLETE {
border-bottom: 2px dotted #999;
}
.gcliERROR {
border-bottom: 2px dotted #F00;
}
.gcliPrompt {
color: #66F;
font-weight: bold;
}
.gcliCompl {
color: #999;
}
.gcliCloseBrace {
color: #999;
}

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

@ -324,29 +324,6 @@ html[dir=rtl] .undo .close {
opacity: 1.0;
}
/* InfoItems
----------------------------------*/
.info-item {
cursor: move;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(248,248,248,1);
border-radius: 0.4em;
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) 1px 1px 3px;
}
html[dir=rtl] .info-item {
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) -1px 1px 3px;
}
.intro {
margin: 10px;
}
/* Trenches
----------------------------------*/
@ -628,6 +605,10 @@ html[dir=rtl] #otherresults {
-moz-margin-end: 5px;
}
#otherresults .label:-moz-window-inactive {
color: #404040;
}
.inlineMatch {
background-color: #EBEBEB;
border-radius: 0.4em;

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

@ -0,0 +1,241 @@
/* ***** 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 GCLI.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Walker <jwalker@mozilla.com> (original author)
*
* 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 ***** */
/* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
.gcliterm-input-node,
.gcliterm-complete-node {
border: none;
-moz-appearance: none;
height: 100%;
vertical-align: middle;
background-color: transparent;
font: 12px Consolas, "Lucida Console", monospace;
padding: 2px 0 0 16px;
}
.gcliterm-complete-node {
color: #FFF;
padding: 4px 4px 2px 21px;
}
.gcliVALID {
border-bottom: none;
}
.gcliINCOMPLETE {
color: #DDD;
border-bottom: 1px dotted #999;
}
.gcliERROR {
color: #DDD;
border-bottom: 1px dotted #F00;
}
.gcliCompl {
color: #999;
}
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
}
.gcliterm-hint-node {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-bottom: 0px !important;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: auto;
padding: 10px;
}
.gcliterm-hint-parent {
border-bottom: 1px solid #AAA;
}
.gcliCmdHelpRight {
text-align: right;
}
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcliCmdDesc {
font-weight: bold;
text-align: center;
margin-bottom: 5px;
border-bottom: 1px solid #ddd;
padding-bottom: 3px;
}
.gcliParamGroup {
font-weight: bold;
}
.gcliParamName {
text-align: right;
font-size: 90%;
}
.gcliParamError {
font-size: 80%;
color: #900;
}
.gcliParamSubmit {
text-align: right;
}
.gcliGroupSymbol {
font-size: 90%;
color: #666;
}
.gcliRequired {
font-size: 80%;
color: #666;
}
.gcliParams {
width: 100%;
}
/* From: $GCLI/lib/gcli/ui/hinter.css */
.gcliHintParent {
color: #000;
background: rgba(250, 250, 250, 0.8);
border: 1px solid #AAA;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: 10px;
margin-right: 10px;
display: inline-block;
overflow: hidden;
}
.gcliHints {
overflow: auto;
padding: 10px;
display: inline-block;
}
.gcliHints ul {
margin: 0;
padding: 0 15px;
}
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcliOption {
overflow: hidden;
white-space: nowrap;
cursor: pointer;
padding: 2px;
}
.gcliOption:hover {
background-color: rgb(230, 230, 230);
}
.gcliOptionName {
padding-right: 5px;
}
.gcliOptionDesc {
font-size: 80%;
color: #999;
}
.gcliMenuError {
overflow: hidden;
white-space: nowrap;
padding: 8px 2px 2px 2px;
font-size: 80%;
color: red;
}
.gcliMenuField {
background-color: white;
color: black;
border: 1px solid #aaa;
padding: 2px;
max-height: 300px;
overflow-y: auto;
max-width: 220px;
overflow-x: hidden;
margin: 0px 10px;
border-top: 0px !important;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
}
/* From: $GCLI/lib/gcli/ui/inputter.css */
.gcliCompletion {
position: absolute;
z-index: -1000;
background-color: #DDD;
border: 1px transparent solid;
padding: 1px 1px 1px 2px;
}
.gcliCompletion {
color: #DDD;
}
.gcliINCOMPLETE {
border-bottom: 2px dotted #999;
}
.gcliERROR {
border-bottom: 2px dotted #F00;
}
.gcliPrompt {
color: #66F;
font-weight: bold;
}
.gcliCompl {
color: #999;
}
.gcliCloseBrace {
color: #999;
}

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

@ -109,6 +109,7 @@ browser.jar:
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/browser/devtools/search.png (devtools/search.png)
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png
@ -232,6 +233,7 @@ browser.jar:
skin/classic/aero/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/aero/browser/devtools/search.png (devtools/search.png)
skin/classic/aero/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
skin/classic/aero/browser/devtools/gcli.css (devtools/gcli.css)
#ifdef MOZ_SERVICES_SYNC
skin/classic/aero/browser/sync-throbber.png
skin/classic/aero/browser/sync-16.png

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

@ -347,29 +347,6 @@ html[dir=rtl] .undo .close {
opacity: 1.0;
}
/* InfoItems
----------------------------------*/
.info-item {
cursor: move;
border: 1px solid rgba(230,230,230,1);
background-color: rgba(248,248,248,1);
border-radius: 0.4em;
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) 1px 1px 3px;
}
.info-item {
box-shadow:
inset rgba(255, 255, 255, 0.6) 0 0 0 2px,
rgba(0,0,0, .2) -1px 1px 3px;
}
.intro {
margin: 10px;
}
/* Trenches
----------------------------------*/

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

@ -37,6 +37,7 @@
#
# ***** END LICENSE BLOCK *****
from __future__ import with_statement
import codecs
from datetime import datetime, timedelta
import itertools
@ -50,8 +51,8 @@ import subprocess
import sys
import threading
import tempfile
import zipfile
import sqlite3
import zipfile
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, SCRIPT_DIR)
@ -97,6 +98,69 @@ _log.setLevel(logging.INFO)
_log.addHandler(handler)
class ZipFileReader(object):
"""
Class to read zip files in Python 2.5 and later. Limited to only what we
actually use.
"""
def __init__(self, filename):
self._zipfile = zipfile.ZipFile(filename, "r")
def __del__(self):
self._zipfile.close()
def _getnormalizedpath(self, path):
"""
Gets a normalized path from 'path' (or the current working directory if
'path' is None). Also asserts that the path exists.
"""
if path is None:
path = os.curdir
path = os.path.normpath(os.path.expanduser(path))
assert os.path.isdir(path)
return path
def _extractname(self, name, path):
"""
Extracts a file with the given name from the zip file to the given path.
Also creates any directories needed along the way.
"""
filename = os.path.normpath(os.path.join(path, name))
if name.endswith("/"):
os.makedirs(filename)
else:
path = os.path.split(filename)[0]
if not os.path.isdir(path):
os.makedirs(path)
with open(filename, "wb") as dest:
dest.write(self._zipfile.read(name))
def namelist(self):
return self._zipfile.namelist()
def read(self, name):
return self._zipfile.read(name)
def extract(self, name, path = None):
if hasattr(self._zipfile, "extract"):
return self._zipfile.extract(name, path)
# This will throw if name is not part of the zip file.
self._zipfile.getinfo(name)
self._extractname(name, self._getnormalizedpath(path))
def extractall(self, path = None):
if hasattr(self._zipfile, "extractall"):
return self._zipfile.extractall(path)
path = self._getnormalizedpath(path)
for name in self._zipfile.namelist():
self._extractname(name, path)
#################
# PROFILE SETUP #
#################
@ -923,35 +987,87 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
return status
"""
Copies an extension into the extensions directory of the given profile.
extensionSource - the source location of the extension files. This can be either
a directory or a path to an xpi file.
profileDir - the profile directory we are copying into. We will create the
"extensions" directory there if it doesn't exist.
extensionID - the id of the extension to be used as the containing directory for the
extension, if extensionSource is a directory, i.e.
this is the name of the folder in the <profileDir>/extensions/<extensionID>
"""
def getExtensionIDFromRDF(self, rdfSource):
"""
Retrieves the extension id from an install.rdf file (or string).
"""
from xml.dom.minidom import parse, parseString, Node
if isinstance(rdfSource, file):
document = parse(rdfSource)
else:
document = parseString(rdfSource)
# Find the <em:id> element. There can be multiple <em:id> tags
# within <em:targetApplication> tags, so we have to check this way.
for rdfChild in document.documentElement.childNodes:
if rdfChild.nodeType == Node.ELEMENT_NODE and rdfChild.tagName == "Description":
for descChild in rdfChild.childNodes:
if descChild.nodeType == Node.ELEMENT_NODE and descChild.tagName == "em:id":
return descChild.childNodes[0].data
return None
def installExtension(self, extensionSource, profileDir, extensionID = None):
"""
Copies an extension into the extensions directory of the given profile.
extensionSource - the source location of the extension files. This can be either
a directory or a path to an xpi file.
profileDir - the profile directory we are copying into. We will create the
"extensions" directory there if it doesn't exist.
extensionID - the id of the extension to be used as the containing directory for the
extension, if extensionSource is a directory, i.e.
this is the name of the folder in the <profileDir>/extensions/<extensionID>
"""
if not os.path.isdir(profileDir):
self.log.info("INFO | automation.py | Cannot install extension, invalid profileDir at: %s", profileDir)
return
extnsdir = os.path.join(profileDir, "extensions")
installRDFFilename = "install.rdf"
extensionsRootDir = os.path.join(profileDir, "extensions")
if not os.path.isdir(extensionsRootDir):
os.mkdir(extensionsRootDir)
if os.path.isfile(extensionSource):
# Copy extension xpi directly.
# "destination file is created or overwritten".
shutil.copy2(extensionSource, extnsdir)
elif os.path.isdir(extensionSource):
if extensionID == None:
reader = ZipFileReader(extensionSource)
for filename in reader.namelist():
# Sanity check the zip file.
if os.path.isabs(filename):
self.log.info("INFO | automation.py | Cannot install extension, bad files in xpi")
return
# We may need to dig the extensionID out of the zip file...
if extensionID is None and filename == installRDFFilename:
extensionID = self.getExtensionIDFromRDF(reader.read(filename))
# We must know the extensionID now.
if extensionID is None:
self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
return
# Make the extension directory.
extensionDir = os.path.join(extensionsRootDir, extensionID)
os.mkdir(extensionDir)
# Extract all files.
reader.extractall(extensionDir)
elif os.path.isdir(extensionSource):
if extensionID is None:
filename = os.path.join(extensionSource, installRDFFilename)
if os.path.isfile(filename):
with open(filename, "r") as installRDF:
extensionID = self.getExtensionIDFromRDF(installRDF)
if extensionID is None:
self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
return
# Copy extension tree into its own directory.
# "destination directory must not already exist".
shutil.copytree(extensionSource, os.path.join(extnsdir, extensionID))
shutil.copytree(extensionSource, os.path.join(extensionsRootDir, extensionID))
else:
self.log.info("INFO | automation.py | Cannot install extension, invalid extensionSource at: %s", extensionSource)
return

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

@ -323,7 +323,8 @@ class DeviceManagerADB(DeviceManager):
ret.append(f)
line = p.stderr.readline()
#the last line is a summary
ret.pop(len(ret) - 1)
if (len(ret) > 0):
ret.pop()
return ret

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

@ -61,6 +61,6 @@ CPPSRCS = \
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../include \
-I$(topsrcdir)/js/src/xpconnect/src \
-I$(topsrcdir)/js/xpconnect/src \
-I$(topsrcdir)/dom/base

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

@ -42,6 +42,8 @@
* same-origin with anything but themselves.
*/
#include "mozilla/Util.h"
#include "nsNullPrincipal.h"
#include "nsNullPrincipalURI.h"
#include "nsMemory.h"
@ -53,6 +55,8 @@
#include "nsDOMError.h"
#include "nsScriptSecurityManager.h"
using namespace mozilla;
NS_IMPL_CLASSINFO(nsNullPrincipal, NULL, nsIClassInfo::MAIN_THREAD_ONLY,
NS_NULLPRINCIPAL_CID)
NS_IMPL_QUERY_INTERFACE2_CI(nsNullPrincipal,
@ -111,7 +115,7 @@ nsNullPrincipal::Init()
id.ToProvidedString(chars);
PRUint32 suffixLen = NSID_LENGTH - 1;
PRUint32 prefixLen = NS_ARRAY_LENGTH(NS_NULLPRINCIPAL_PREFIX) - 1;
PRUint32 prefixLen = ArrayLength(NS_NULLPRINCIPAL_PREFIX) - 1;
// Use an nsCString so we only do the allocation once here and then share
// with nsJSPrincipals

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

@ -40,6 +40,9 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "xpcprivate.h"
#include "nsScriptSecurityManager.h"
#include "nsIServiceManager.h"
@ -944,7 +947,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
objectDomainUnicode.get()
};
PRUint32 length = NS_ARRAY_LENGTH(formatStrings);
PRUint32 length = ArrayLength(formatStrings);
// XXXbz Our localization system is stupid and can't handle not showing
// some strings that get passed in. Which means that we have to get
@ -966,7 +969,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
if (!objectDomainUnicode.IsEmpty()) {
stringName.AppendLiteral("ObjectDomain");
length += 1;
if (length != NS_ARRAY_LENGTH(formatStrings)) {
if (length != ArrayLength(formatStrings)) {
// We have an object domain but not a subject domain.
// Scoot our string over one slot. See the XXX comment
// above for why we need to do this.
@ -1588,7 +1591,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
rv = sStrBundle->
FormatStringFromName(NS_LITERAL_STRING("ProtocolFlagError").get(),
formatStrings,
NS_ARRAY_LENGTH(formatStrings),
ArrayLength(formatStrings),
getter_Copies(message));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIConsoleService> console(
@ -1629,7 +1632,7 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag,
const PRUnichar *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() };
rv = sStrBundle->FormatStringFromName(PromiseFlatString(messageTag).get(),
formatStrings,
NS_ARRAY_LENGTH(formatStrings),
ArrayLength(formatStrings),
getter_Copies(message));
NS_ENSURE_SUCCESS(rv, rv);
@ -1708,7 +1711,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI
};
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(flags); ++i) {
for (PRUint32 i = 0; i < ArrayLength(flags); ++i) {
rv = fixup->CreateFixupURI(aTargetURIStr, flags[i],
getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
@ -2681,7 +2684,7 @@ nsScriptSecurityManager::FormatCapabilityString(nsAString& aCapability)
rv = sStrBundle->FormatStringFromName(
NS_LITERAL_STRING("ExtensionCapability").get(),
formatArgs,
NS_ARRAY_LENGTH(formatArgs),
ArrayLength(formatArgs),
getter_Copies(extensionCap));
if (NS_SUCCEEDED(rv))
newcaps += extensionCap;
@ -2770,7 +2773,7 @@ nsScriptSecurityManager::CheckConfirmDialog(JSContext* cx, nsIPrincipal* aPrinci
nsXPIDLString message;
rv = sStrBundle->FormatStringFromName(NS_LITERAL_STRING("EnableCapabilityQuery").get(),
formatStrings,
NS_ARRAY_LENGTH(formatStrings),
ArrayLength(formatStrings),
getter_Copies(message));
if (NS_FAILED(rv))
return PR_FALSE;
@ -2893,7 +2896,7 @@ nsScriptSecurityManager::EnableCapability(const char *capability)
nsXPIDLString message;
rv = sStrBundle->FormatStringFromName(NS_LITERAL_STRING("EnableCapabilityDenied").get(),
formatStrings,
NS_ARRAY_LENGTH(formatStrings),
ArrayLength(formatStrings),
getter_Copies(message));
if (NS_FAILED(rv))
return rv;
@ -3059,7 +3062,7 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
className.get(),
originUnicode.get()
};
PRUint32 length = NS_ARRAY_LENGTH(formatStrings);
PRUint32 length = ArrayLength(formatStrings);
if (originUnicode.IsEmpty()) {
--length;
} else {
@ -3853,7 +3856,7 @@ nsScriptSecurityManager::InitPrincipals(PRUint32 aPrefCount, const char** aPrefN
for (PRUint32 c = 0; c < aPrefCount; c++)
{
PRInt32 prefNameLen = PL_strlen(aPrefNames[c]) -
(NS_ARRAY_LENGTH(idSuffix) - 1);
(ArrayLength(idSuffix) - 1);
if (PL_strcasecmp(aPrefNames[c] + prefNameLen, idSuffix) != 0)
continue;

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

@ -153,6 +153,8 @@ MOZ_MEDIA = @MOZ_MEDIA@
MOZ_VORBIS = @MOZ_VORBIS@
MOZ_TREMOR = @MOZ_TREMOR@
MOZ_WEBM = @MOZ_WEBM@
MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
VPX_AS = @VPX_AS@
VPX_ASFLAGS = @VPX_ASFLAGS@
VPX_DASH_C_FLAG = @VPX_DASH_C_FLAG@
@ -160,6 +162,7 @@ VPX_AS_CONVERSION = @VPX_AS_CONVERSION@
VPX_ASM_SUFFIX = @VPX_ASM_SUFFIX@
VPX_X86_ASM = @VPX_X86_ASM@
VPX_ARM_ASM = @VPX_ARM_ASM@
VPX_NEED_OBJ_INT_EXTRACT = @VPX_NEED_OBJ_INT_EXTRACT@
LIBJPEG_TURBO_AS = @LIBJPEG_TURBO_AS@
LIBJPEG_TURBO_ASFLAGS = @LIBJPEG_TURBO_ASFLAGS@
LIBJPEG_TURBO_X86_ASM = @LIBJPEG_TURBO_X86_ASM@
@ -362,11 +365,6 @@ LIBS_DESC_SUFFIX = @LIBS_DESC_SUFFIX@
USE_N32 = @USE_N32@
HAVE_64BIT_OS = @HAVE_64BIT_OS@
# Temp hack. It is not my intention to leave this crap in here for ever.
# Im talking to fur right now to solve the problem without introducing
# NS_USE_NATIVE to the build system -ramiro.
NS_USE_NATIVE = @NS_USE_NATIVE@
CC = @CC@
CXX = @CXX@
@ -650,7 +648,7 @@ MACOS_SDK_DIR = @MACOS_SDK_DIR@
NEXT_ROOT = @NEXT_ROOT@
GCC_VERSION = @GCC_VERSION@
UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
MOZ_CAN_RUN_PROGRAMS = MOZ_CAN_RUN_PROGRAMS@
MOZ_CAN_RUN_PROGRAMS = @MOZ_CAN_RUN_PROGRAMS@
HAVE_DTRACE= @HAVE_DTRACE@
VISIBILITY_FLAGS = @VISIBILITY_FLAGS@

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

@ -2488,7 +2488,6 @@ ia64*-hpux*)
if test "$SOLARIS_SUNPRO_CC"; then
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
LIBS="-lCrun -lCstd -lc $LIBS"
NS_USE_NATIVE=1
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
@ -4326,6 +4325,8 @@ MOZ_TREMOR=
MOZ_WAVE=1
MOZ_MEDIA=
MOZ_WEBM=1
MOZ_VP8_ERROR_CONCEALMENT=
MOZ_VP8_ENCODER=
VPX_AS=
VPX_ASFLAGS=
VPX_AS_DASH_C_FLAG=
@ -5347,6 +5348,12 @@ MOZ_LIBVPX_LIBS=
if test -n "$MOZ_WEBM"; then
AC_DEFINE(MOZ_WEBM)
if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
fi
if test -n "$MOZ_VP8_ENCODER" ; then
AC_DEFINE(MOZ_VP8_ENCODER)
fi
if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
_SAVE_CFLAGS=$CFLAGS
@ -5357,16 +5364,41 @@ if test -n "$MOZ_WEBM"; then
fi
CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
MOZ_NATIVE_LIBVPX_DEC_TEST=
MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
[if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
fi],
AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
[MOZ_NATIVE_LIBVPX=1
MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
[MOZ_NATIVE_LIBVPX_DEC_TEST=1],
([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
AC_MSG_CHECKING([for libvpx version >= v0.9.7])
dnl We need at least v0.9.7 to fix several crash bugs (for which we
dnl had local patches prior to v0.9.7).
dnl
dnl This is a terrible test for the library version, but we don't
dnl have a good one. There is no version number in a public header,
dnl and testing the headers still doesn't guarantee we link against
dnl the right version. While we could call vpx_codec_version() at
dnl run-time, that would break cross-compiling. There are no
dnl additional exported symbols between the v0.9.7 release and the
dnl v0.9.6 one to check for.
AC_TRY_COMPILE([
#include <vpx/vpx_decoder.h>
#if !defined(VPX_CODEC_USE_INPUT_PARTITION)
#error "test failed."
#endif
],
[return 0;],
[AC_MSG_RESULT([yes])
MOZ_NATIVE_LIBVPX=1
MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])])
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
@ -5395,6 +5427,7 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
dnl We currently require gcc on all arm platforms.
VPX_AS=$YASM
VPX_ASM_SUFFIX=asm
VPX_NEED_OBJ_INT_EXTRACT=
dnl See if we have assembly on this platform.
case "$OS_ARCH:$CPU_ARCH" in
@ -5438,6 +5471,7 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
else
VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1
dnl The encoder needs obj_int_extract to get asm offsets.
fi
fi
;;
@ -5458,6 +5492,16 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
fi
if test -n "$MOZ_VP8_ENCODER" -a \
-z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
dnl We prefer to get asm offsets using inline assembler, which the above
dnl compilers can do. When we're not using one of those, we have to fall
dnl back to obj_int_extract, which reads them from a compiled object
dnl file. Unfortunately, that only works if we're compiling on a system
dnl with the header files for the appropriate object file format.
VPX_NEED_OBJ_INT_EXTRACT=1
fi
if test -n "$VPX_X86_ASM"; then
AC_DEFINE(VPX_X86_ASM)
elif test -n "$VPX_ARM_ASM"; then
@ -8209,7 +8253,6 @@ AC_SUBST(WINDRES)
AC_SUBST(IMPLIB)
AC_SUBST(FILTER)
AC_SUBST(BIN_FLAGS)
AC_SUBST(NS_USE_NATIVE)
AC_SUBST(MOZ_WIDGET_TOOLKIT)
AC_SUBST(MOZ_UPDATE_XTERM)
AC_SUBST(MOZ_PLATFORM_MAEMO)
@ -8472,6 +8515,8 @@ AC_SUBST(MOZ_WAVE)
AC_SUBST(MOZ_VORBIS)
AC_SUBST(MOZ_TREMOR)
AC_SUBST(MOZ_WEBM)
AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
AC_SUBST(MOZ_VP8_ENCODER)
AC_SUBST(MOZ_OGG)
AC_SUBST(MOZ_ALSA_LIBS)
AC_SUBST(VPX_AS)
@ -8481,6 +8526,7 @@ AC_SUBST(VPX_AS_CONVERSION)
AC_SUBST(VPX_ASM_SUFFIX)
AC_SUBST(VPX_X86_ASM)
AC_SUBST(VPX_ARM_ASM)
AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
AC_SUBST(LIBJPEG_TURBO_AS)
AC_SUBST(LIBJPEG_TURBO_ASFLAGS)

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

@ -45,7 +45,7 @@
"@mozilla.org/layout/htmlCopyEncoder;1"
// {972D8D8F-F0DA-11d4-9885-00C04FA0CF4B}
#define NS_DOCUMENT_VIEWER_CID \
#define NS_CONTENT_VIEWER_CID \
{ 0x972d8d8f, 0xf0da, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {FC886801-E768-11d4-9885-00C04FA0CF4B}

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

@ -189,6 +189,7 @@ struct nsShortcutCandidate {
class nsContentUtils
{
friend class nsAutoScriptBlockerSuppressNodeRemoved;
friend class mozilla::AutoRestore<bool>;
typedef mozilla::dom::Element Element;
typedef mozilla::TimeDuration TimeDuration;
@ -1061,13 +1062,15 @@ public:
* @param aPreventScriptExecution true to prevent scripts from executing;
* don't set to false when parsing into a target node that has been
* bound to tree.
* @return NS_ERROR_DOM_INVALID_STATE_ERR if a re-entrant attempt to parse
* fragments is made and NS_OK otherwise.
*/
static void ParseFragmentHTML(const nsAString& aSourceBuffer,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
bool aQuirks,
bool aPreventScriptExecution);
static nsresult ParseFragmentHTML(const nsAString& aSourceBuffer,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
bool aQuirks,
bool aPreventScriptExecution);
/**
* Invoke the fragment parsing algorithm (innerHTML) using the XML parser.
@ -1077,6 +1080,8 @@ public:
* @param aTagStack the namespace mapping context
* @param aPreventExecution whether to mark scripts as already started
* @param aReturn the result fragment
* @return NS_ERROR_DOM_INVALID_STATE_ERR if a re-entrant attempt to parse
* fragments is made, a return code from the XML parser.
*/
static nsresult ParseFragmentXML(const nsAString& aSourceBuffer,
nsIDocument* aDocument,
@ -1099,6 +1104,7 @@ public:
* @param aPrincipal Prinicpal of the document. Must not be null.
* @param aScriptObject The object from which the context for event handling
* can be got.
* @param aSVGDocument Force SVG Document creation.
* @param aResult [out] The document that was created.
*/
static nsresult CreateDocument(const nsAString& aNamespaceURI,
@ -1108,6 +1114,7 @@ public:
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal,
nsIScriptGlobalObject* aScriptObject,
bool aSVGDocument,
nsIDOMDocument** aResult);
/**
@ -1909,6 +1916,11 @@ private:
static nsIParser* sXMLFragmentParser;
static nsIFragmentContentSink* sXMLFragmentSink;
/**
* True if there's a fragment parser activation on the stack.
*/
static bool sFragmentParsingActive;
static nsString* sShiftText;
static nsString* sControlText;
static nsString* sMetaText;

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