This commit is contained in:
Richard Newman 2012-04-09 18:57:46 -07:00
Родитель 7540487f7c b6b17661cb
Коммит 5619e2132f
370 изменённых файлов: 7688 добавлений и 7830 удалений

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

@ -58,6 +58,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../src
SHARED_LIBRARY_LIBS = \
../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \
../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \

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

@ -61,6 +61,7 @@ DIRS += $(PLATFORM_DIR)
DIRS += \
base \
generic \
html \
xpcom \
xforms \

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

@ -0,0 +1,343 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ARIAStateMap.h"
#include "States.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
using namespace mozilla::a11y::aria;
/**
* Used to store state map rule data for ARIA attribute of enum type.
*/
struct EnumTypeData
{
EnumTypeData(nsIAtom* aAttrName,
nsIAtom** aValue1, PRUint64 aState1,
nsIAtom** aValue2, PRUint64 aState2,
nsIAtom** aValue3 = 0, PRUint64 aState3 = 0) :
mState1(aState1), mState2(aState2), mState3(aState3), mDefaultState(0),
mAttrName(aAttrName), mValue1(aValue1), mValue2(aValue2), mValue3(aValue3),
mNullValue(nsnull)
{ }
EnumTypeData(nsIAtom* aAttrName, PRUint64 aDefaultState,
nsIAtom** aValue1, PRUint64 aState1) :
mState1(aState1), mState2(0), mState3(0), mDefaultState(aDefaultState),
mAttrName(aAttrName), mValue1(aValue1), mValue2(nsnull), mValue3(nsnull),
mNullValue(nsnull)
{ }
// States applied if corresponding enum values are matched.
const PRUint64 mState1;
const PRUint64 mState2;
const PRUint64 mState3;
// Default state if no one enum value is matched.
const PRUint64 mDefaultState;
// ARIA attribute name.
nsIAtom* const mAttrName;
// States if the attribute value is matched to the enum value. Used as
// nsIContent::AttrValuesArray.
nsIAtom* const* const mValue1;
nsIAtom* const* const mValue2;
nsIAtom* const* const mValue3;
nsIAtom* const* const mNullValue;
};
enum ETokenType
{
eBoolType = 0,
eMixedType = 1, // can take 'mixed' value
eDefinedIfAbsent = 2 // permanent and false state are applied if absent
};
/**
* Used to store state map rule data for ARIA attribute of token type (including
* mixed value).
*/
struct TokenTypeData
{
TokenTypeData(nsIAtom* aAttrName, PRUint32 aType,
PRUint64 aPermanentState,
PRUint64 aTrueState,
PRUint64 aFalseState = 0) :
mAttrName(aAttrName), mType(aType), mPermanentState(aPermanentState),
mTrueState(aTrueState), mFalseState(aFalseState)
{ }
// ARIA attribute name.
nsIAtom* const mAttrName;
// Type.
const PRUint32 mType;
// State applied if the attribute is defined or mType doesn't have
// eDefinedIfAbsent flag set.
const PRUint64 mPermanentState;
// States applied if the attribute value is true/false.
const PRUint64 mTrueState;
const PRUint64 mFalseState;
};
/**
* Map enum type attribute value to accessible state.
*/
static void MapEnumType(dom::Element* aElement, PRUint64* aState,
const EnumTypeData& aData);
/**
* Map token type attribute value to states.
*/
static void MapTokenType(dom::Element* aContent, PRUint64* aState,
const TokenTypeData& aData);
bool
aria::MapToState(EStateRule aRule, dom::Element* aElement, PRUint64* aState)
{
switch (aRule) {
case eARIAAutoComplete:
{
static const EnumTypeData data(
nsGkAtoms::aria_autocomplete,
&nsGkAtoms::inlinevalue, states::SUPPORTS_AUTOCOMPLETION,
&nsGkAtoms::list, states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION,
&nsGkAtoms::both, states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION);
MapEnumType(aElement, aState, data);
return true;
}
case eARIABusy:
{
static const EnumTypeData data(
nsGkAtoms::aria_busy,
&nsGkAtoms::_true, states::BUSY,
&nsGkAtoms::error, states::INVALID);
MapEnumType(aElement, aState, data);
return true;
}
case eARIACheckableBool:
{
static const TokenTypeData data(
nsGkAtoms::aria_checked, eBoolType | eDefinedIfAbsent,
states::CHECKABLE, states::CHECKED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIACheckableMixed:
{
static const TokenTypeData data(
nsGkAtoms::aria_checked, eMixedType | eDefinedIfAbsent,
states::CHECKABLE, states::CHECKED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIACheckedMixed:
{
static const TokenTypeData data(
nsGkAtoms::aria_checked, eMixedType,
states::CHECKABLE, states::CHECKED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIADisabled:
{
static const TokenTypeData data(
nsGkAtoms::aria_disabled, eBoolType,
0, states::UNAVAILABLE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAExpanded:
{
static const TokenTypeData data(
nsGkAtoms::aria_expanded, eBoolType,
0, states::EXPANDED, states::COLLAPSED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAHasPopup:
{
static const TokenTypeData data(
nsGkAtoms::aria_haspopup, eBoolType,
0, states::HASPOPUP);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAInvalid:
{
static const TokenTypeData data(
nsGkAtoms::aria_invalid, eBoolType,
0, states::INVALID);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAMultiline:
{
static const TokenTypeData data(
nsGkAtoms::aria_multiline, eBoolType | eDefinedIfAbsent,
0, states::MULTI_LINE, states::SINGLE_LINE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAMultiSelectable:
{
static const TokenTypeData data(
nsGkAtoms::aria_multiselectable, eBoolType,
0, states::MULTISELECTABLE | states::EXTSELECTABLE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAOrientation:
{
static const EnumTypeData data(
nsGkAtoms::aria_orientation, states::HORIZONTAL,
&nsGkAtoms::vertical, states::VERTICAL);
MapEnumType(aElement, aState, data);
return true;
}
case eARIAPressed:
{
static const TokenTypeData data(
nsGkAtoms::aria_pressed, eMixedType,
states::CHECKABLE, states::PRESSED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAReadonly:
{
static const TokenTypeData data(
nsGkAtoms::aria_readonly, eBoolType,
0, states::READONLY);
MapTokenType(aElement, aState, data);
return true;
}
case eARIAReadonlyOrEditable:
{
static const TokenTypeData data(
nsGkAtoms::aria_readonly, eBoolType | eDefinedIfAbsent,
0, states::READONLY, states::EDITABLE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIARequired:
{
static const TokenTypeData data(
nsGkAtoms::aria_required, eBoolType,
0, states::REQUIRED);
MapTokenType(aElement, aState, data);
return true;
}
case eARIASelectable:
{
static const TokenTypeData data(
nsGkAtoms::aria_selected, eBoolType | eDefinedIfAbsent,
states::SELECTABLE, states::SELECTED);
MapTokenType(aElement, aState, data);
return true;
}
case eReadonlyUntilEditable:
{
if (!(*aState & states::EDITABLE))
*aState |= states::READONLY;
return true;
}
default:
return false;
}
}
static void
MapEnumType(dom::Element* aElement, PRUint64* aState, const EnumTypeData& aData)
{
switch (aElement->FindAttrValueIn(kNameSpaceID_None, aData.mAttrName,
&aData.mValue1, eCaseMatters)) {
case 0:
*aState |= aData.mState1;
return;
case 1:
*aState |= aData.mState2;
return;
case 2:
*aState |= aData.mState3;
return;
}
*aState |= aData.mDefaultState;
}
static void
MapTokenType(dom::Element* aElement, PRUint64* aState,
const TokenTypeData& aData)
{
if (aElement->HasAttr(kNameSpaceID_None, aData.mAttrName)) {
if ((aData.mType & eMixedType) &&
aElement->AttrValueIs(kNameSpaceID_None, aData.mAttrName,
nsGkAtoms::mixed, eCaseMatters)) {
*aState |= aData.mPermanentState | states::MIXED;
return;
}
if (aElement->AttrValueIs(kNameSpaceID_None, aData.mAttrName,
nsGkAtoms::_false, eCaseMatters)) {
*aState |= aData.mPermanentState | aData.mFalseState;
return;
}
if (!aElement->AttrValueIs(kNameSpaceID_None, aData.mAttrName,
nsGkAtoms::_undefined, eCaseMatters) &&
!aElement->AttrValueIs(kNameSpaceID_None, aData.mAttrName,
nsGkAtoms::_empty, eCaseMatters)) {
*aState |= aData.mPermanentState | aData.mTrueState;
}
return;
}
if (aData.mType & eDefinedIfAbsent)
*aState |= aData.mPermanentState | aData.mFalseState;
}

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

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _mozilla_a11y_aria_ARIAStateMap_h_
#define _mozilla_a11y_aria_ARIAStateMap_h_
#include "prtypes.h"
namespace mozilla {
namespace dom {
class Element;
}
namespace a11y {
namespace aria {
/**
* List of the ARIA state mapping rules.
*/
enum EStateRule
{
eARIANone,
eARIAAutoComplete,
eARIABusy,
eARIACheckableBool,
eARIACheckableMixed,
eARIACheckedMixed,
eARIADisabled,
eARIAExpanded,
eARIAHasPopup,
eARIAInvalid,
eARIAMultiline,
eARIAMultiSelectable,
eARIAOrientation,
eARIAPressed,
eARIAReadonly,
eARIAReadonlyOrEditable,
eARIARequired,
eARIASelectable,
eReadonlyUntilEditable
};
/**
* Expose the accessible states for the given element accordingly to state
* mapping rule.
*
* @param aRule [in] state mapping rule ID
* @param aElement [in] node of the accessible
* @param aState [in/out] accessible states
* @return true if state map rule ID is valid
*/
bool MapToState(EStateRule aRule, dom::Element* aElement, PRUint64* aState);
} // namespace aria
} // namespace a11y
} // namespace mozilla
#endif

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

@ -52,6 +52,7 @@ CPPSRCS = \
AccEvent.cpp \
AccGroupInfo.cpp \
AccIterator.cpp \
ARIAStateMap.cpp \
filters.cpp \
FocusManager.cpp \
NotificationController.cpp \
@ -60,7 +61,6 @@ CPPSRCS = \
nsARIAGridAccessible.cpp \
nsARIAMap.cpp \
nsDocAccessible.cpp \
nsOuterDocAccessible.cpp \
nsCoreUtils.cpp \
nsAccUtils.cpp \
nsAccessibilityService.cpp \
@ -92,6 +92,7 @@ EXPORTS = \
EXPORTS_NAMESPACES = mozilla/a11y
EXPORTS_mozilla/a11y = \
ARIAStateMap.h \
FocusManager.h \
States.h \
Role.h \

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

@ -39,20 +39,20 @@
#include "nsARIAMap.h"
#include "nsIAccessibleRole.h"
#include "Role.h"
#include "States.h"
#include "nsIContent.h"
using namespace mozilla::a11y;
using namespace mozilla::a11y::aria;
/**
* This list of WAI-defined roles are currently hardcoded.
* Eventually we will most likely be loading an RDF resource that contains this information
* Using RDF will also allow for role extensibility. See bug 280138.
*
* Definition of nsRoleMapEntry and nsStateMapEntry contains comments explaining this table.
* Definition of nsRoleMapEntry contains comments explaining this table.
*
* When no nsIAccessibleRole enum mapping exists for an ARIA role, the
* role will be exposed via the object attribute "xml-roles".
@ -607,92 +607,12 @@ nsRoleMapEntry nsARIAMap::gEmptyRoleMap = {
kNoReqStates
};
nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
// eARIANone
nsStateMapEntry(),
// eARIAAutoComplete
nsStateMapEntry(&nsGkAtoms::aria_autocomplete,
"inline", states::SUPPORTS_AUTOCOMPLETION,
"list", states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION,
"both", states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION),
// eARIABusy
nsStateMapEntry(&nsGkAtoms::aria_busy,
"true", states::BUSY,
"error", states::INVALID),
// eARIACheckableBool
nsStateMapEntry(&nsGkAtoms::aria_checked, kBoolType,
states::CHECKABLE, states::CHECKED, 0, true),
// eARIACheckableMixed
nsStateMapEntry(&nsGkAtoms::aria_checked, kMixedType,
states::CHECKABLE, states::CHECKED, 0, true),
// eARIACheckedMixed
nsStateMapEntry(&nsGkAtoms::aria_checked, kMixedType,
states::CHECKABLE, states::CHECKED, 0),
// eARIADisabled
nsStateMapEntry(&nsGkAtoms::aria_disabled, kBoolType,
0, states::UNAVAILABLE),
// eARIAExpanded
nsStateMapEntry(&nsGkAtoms::aria_expanded, kBoolType,
0, states::EXPANDED, states::COLLAPSED),
// eARIAHasPopup
nsStateMapEntry(&nsGkAtoms::aria_haspopup, kBoolType,
0, states::HASPOPUP),
// eARIAInvalid
nsStateMapEntry(&nsGkAtoms::aria_invalid, kBoolType,
0, states::INVALID),
// eARIAMultiline
nsStateMapEntry(&nsGkAtoms::aria_multiline, kBoolType,
0, states::MULTI_LINE, states::SINGLE_LINE, true),
// eARIAMultiSelectable
nsStateMapEntry(&nsGkAtoms::aria_multiselectable, kBoolType,
0, states::MULTISELECTABLE | states::EXTSELECTABLE),
// eARIAOrientation
nsStateMapEntry(&nsGkAtoms::aria_orientation, eUseFirstState,
"horizontal", states::HORIZONTAL,
"vertical", states::VERTICAL),
// eARIAPressed
nsStateMapEntry(&nsGkAtoms::aria_pressed, kMixedType,
states::CHECKABLE, states::PRESSED),
// eARIAReadonly
nsStateMapEntry(&nsGkAtoms::aria_readonly, kBoolType,
0, states::READONLY),
// eARIAReadonlyOrEditable
nsStateMapEntry(&nsGkAtoms::aria_readonly, kBoolType,
0, states::READONLY, states::EDITABLE, true),
// eARIARequired
nsStateMapEntry(&nsGkAtoms::aria_required, kBoolType,
0, states::REQUIRED),
// eARIASelectable
nsStateMapEntry(&nsGkAtoms::aria_selected, kBoolType,
states::SELECTABLE, states::SELECTED, 0, true),
// eReadonlyUntilEditable
nsStateMapEntry(states::READONLY, states::EDITABLE)
};
/**
* Universal (Global) states:
* The following state rules are applied to any accessible element,
* whether there is an ARIA role or not:
*/
eStateMapEntryID nsARIAMap::gWAIUnivStateMap[] = {
EStateRule nsARIAMap::gWAIUnivStateMap[] = {
eARIABusy,
eARIADisabled,
eARIAExpanded, // Currently under spec review but precedent exists
@ -746,182 +666,3 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
};
PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivAttrMap);
////////////////////////////////////////////////////////////////////////////////
// nsStateMapEntry
nsStateMapEntry::nsStateMapEntry() :
mAttributeName(nsnull),
mIsToken(false),
mPermanentState(0),
mValue1(nsnull),
mState1(0),
mValue2(nsnull),
mState2(0),
mValue3(nsnull),
mState3(0),
mDefaultState(0),
mDefinedIfAbsent(false)
{}
nsStateMapEntry::nsStateMapEntry(PRUint64 aDefaultState,
PRUint64 aExclusingState) :
mAttributeName(nsnull),
mIsToken(false),
mPermanentState(0),
mValue1(nsnull),
mState1(0),
mValue2(nsnull),
mState2(0),
mValue3(nsnull),
mState3(0),
mDefaultState(aDefaultState),
mDefinedIfAbsent(false),
mExcludingState(aExclusingState)
{
}
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
PRUint64 aPermanentState,
PRUint64 aTrueState,
PRUint64 aFalseState,
bool aDefinedIfAbsent) :
mAttributeName(aAttrName),
mIsToken(true),
mPermanentState(aPermanentState),
mValue1("false"),
mState1(aFalseState),
mValue2(nsnull),
mState2(0),
mValue3(nsnull),
mState3(0),
mDefaultState(aTrueState),
mDefinedIfAbsent(aDefinedIfAbsent),
mExcludingState(0)
{
if (aType == kMixedType) {
mValue2 = "mixed";
mState2 = states::MIXED;
}
}
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3, PRUint64 aState3) :
mAttributeName(aAttrName), mIsToken(false), mPermanentState(0),
mValue1(aValue1), mState1(aState1),
mValue2(aValue2), mState2(aState2),
mValue3(aValue3), mState3(aState3),
mDefaultState(0), mDefinedIfAbsent(false), mExcludingState(0)
{
}
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
EDefaultStateRule aDefaultStateRule,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3, PRUint64 aState3) :
mAttributeName(aAttrName), mIsToken(true), mPermanentState(0),
mValue1(aValue1), mState1(aState1),
mValue2(aValue2), mState2(aState2),
mValue3(aValue3), mState3(aState3),
mDefaultState(0), mDefinedIfAbsent(true), mExcludingState(0)
{
if (aDefaultStateRule == eUseFirstState)
mDefaultState = aState1;
}
bool
nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
eStateMapEntryID aStateMapEntryID)
{
// Return true if we should continue.
if (aStateMapEntryID == eARIANone)
return false;
const nsStateMapEntry& entry = nsARIAMap::gWAIStateMap[aStateMapEntryID];
// Non ARIA attribute case. Expose default state until excluding state is
// presented.
if (!entry.mAttributeName) {
if (!(*aState & entry.mExcludingState))
*aState |= entry.mDefaultState;
return true;
}
if (entry.mIsToken) {
// If attribute is considered as defined when it's absent then let's act
// attribute value is "false" supposedly.
bool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.mAttributeName);
if (entry.mDefinedIfAbsent && !hasAttr) {
if (entry.mPermanentState)
*aState |= entry.mPermanentState;
if (entry.mState1)
*aState |= entry.mState1;
return true;
}
// We only have attribute state mappings for NMTOKEN (and boolean) based
// ARIA attributes. According to spec, a value of "undefined" is to be
// treated equivalent to "", or the absence of the attribute. We bail out
// for this case here.
// Note: If this method happens to be called with a non-token based
// attribute, for example: aria-label="" or aria-label="undefined", we will
// bail out and not explore a state mapping, which is safe.
if (!hasAttr ||
aContent->AttrValueIs(kNameSpaceID_None, *entry.mAttributeName,
nsGkAtoms::_empty, eCaseMatters) ||
aContent->AttrValueIs(kNameSpaceID_None, *entry.mAttributeName,
nsGkAtoms::_undefined, eCaseMatters)) {
if (entry.mPermanentState)
*aState &= ~entry.mPermanentState;
return true;
}
if (entry.mPermanentState)
*aState |= entry.mPermanentState;
}
nsAutoString attrValue;
if (!aContent->GetAttr(kNameSpaceID_None, *entry.mAttributeName, attrValue))
return true;
// Apply states for matched value. If no values was matched then apply default
// states.
bool applyDefaultStates = true;
if (entry.mValue1) {
if (attrValue.EqualsASCII(entry.mValue1)) {
applyDefaultStates = false;
if (entry.mState1)
*aState |= entry.mState1;
} else if (entry.mValue2) {
if (attrValue.EqualsASCII(entry.mValue2)) {
applyDefaultStates = false;
if (entry.mState2)
*aState |= entry.mState2;
} else if (entry.mValue3) {
if (attrValue.EqualsASCII(entry.mValue3)) {
applyDefaultStates = false;
if (entry.mState3)
*aState |= entry.mState3;
}
}
}
}
if (applyDefaultStates) {
if (entry.mDefaultState)
*aState |= entry.mDefaultState;
}
return true;
}

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

@ -40,6 +40,7 @@
#ifndef _nsARIAMap_H_
#define _nsARIAMap_H_
#include "mozilla/a11y/ARIAStateMap.h"
#include "mozilla/a11y/Role.h"
#include "prtypes.h"
@ -153,126 +154,12 @@ struct nsAttributeCharacteristics
*/
#define kNoReqStates 0
enum eStateValueType
{
kBoolType,
kMixedType
};
enum EDefaultStateRule
{
//eNoDefaultState,
eUseFirstState
};
/**
* ID for state map entry, used in nsRoleMapEntry.
*/
enum eStateMapEntryID
{
eARIANone,
eARIAAutoComplete,
eARIABusy,
eARIACheckableBool,
eARIACheckableMixed,
eARIACheckedMixed,
eARIADisabled,
eARIAExpanded,
eARIAHasPopup,
eARIAInvalid,
eARIAMultiline,
eARIAMultiSelectable,
eARIAOrientation,
eARIAPressed,
eARIAReadonly,
eARIAReadonlyOrEditable,
eARIARequired,
eARIASelectable,
eReadonlyUntilEditable
};
class nsStateMapEntry
{
public:
/**
* Used to create stub.
*/
nsStateMapEntry();
/**
* Used to expose permanent states presented until accessible has an excluding
* state.
*/
nsStateMapEntry(PRUint64 aDefaultState, PRUint64 aExclusingState);
/**
* Used for ARIA attributes having boolean or mixed values.
*/
nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
PRUint64 aPermanentState,
PRUint64 aTrueState,
PRUint64 aFalseState = 0,
bool aDefinedIfAbsent = false);
/**
* Used for ARIA attributes having enumerated values.
*/
nsStateMapEntry(nsIAtom** aAttrName,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3 = 0, PRUint64 aState3 = 0);
/**
* Used for ARIA attributes having enumerated values, and where a default
* attribute state should be assumed when not supplied by the author.
*/
nsStateMapEntry(nsIAtom** aAttrName, EDefaultStateRule aDefaultStateRule,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3 = 0, PRUint64 aState3 = 0);
/**
* Maps ARIA state map pointed by state map entry ID to accessible states.
*
* @param aContent [in] node of the accessible
* @param aState [in/out] accessible states
* @param aStateMapEntryID [in] state map entry ID
* @return true if state map entry ID is valid
*/
static bool MapToStates(nsIContent* aContent, PRUint64* aState,
eStateMapEntryID aStateMapEntryID);
private:
// ARIA attribute name
nsIAtom** mAttributeName;
// Indicates if attribute is token (can be undefined)
bool mIsToken;
// State applied always if attribute is defined
PRUint64 mPermanentState;
// States applied if attribute value is matched to the stored value
const char* mValue1;
PRUint64 mState1;
const char* mValue2;
PRUint64 mState2;
const char* mValue3;
PRUint64 mState3;
// States applied if no stored values above are matched
PRUint64 mDefaultState;
// Permanent and false states are applied if attribute is absent
bool mDefinedIfAbsent;
// If this state is presented in state bits then default state is not exposed.
PRUint64 mExcludingState;
};
////////////////////////////////////////////////////////////////////////////////
// Role map entry
@ -302,15 +189,15 @@ struct nsRoleMapEntry
// Automatic state mapping rule: always include in nsIAccessibleStates
PRUint64 state; // or kNoReqStates if no nsIAccessibleStates are automatic for this role.
// ARIA properties supported for this role
// (in other words, the aria-foo attribute to nsIAccessibleStates mapping rules)
// Currently you cannot have unlimited mappings, because
// a variable sized array would not allow the use of
// C++'s struct initialization feature.
eStateMapEntryID attributeMap1;
eStateMapEntryID attributeMap2;
eStateMapEntryID attributeMap3;
mozilla::a11y::aria::EStateRule attributeMap1;
mozilla::a11y::aria::EStateRule attributeMap2;
mozilla::a11y::aria::EStateRule attributeMap3;
};
@ -343,17 +230,12 @@ struct nsARIAMap
*/
static nsRoleMapEntry gEmptyRoleMap;
/**
* State map of ARIA state attributes.
*/
static nsStateMapEntry gWAIStateMap[];
/**
* State map of ARIA states applied to any accessible not depending on
* the role.
*/
static eStateMapEntryID gWAIUnivStateMap[];
static mozilla::a11y::aria::EStateRule gWAIUnivStateMap[];
/**
* Map of attribute to attribute characteristics.
*/
@ -364,11 +246,12 @@ struct nsARIAMap
* Return accessible state from ARIA universal states applied to the given
* element.
*/
static PRUint64 UniversalStatesFor(nsIContent* aContent)
static PRUint64 UniversalStatesFor(mozilla::dom::Element* aElement)
{
PRUint64 state = 0;
PRUint32 index = 0;
while (nsStateMapEntry::MapToStates(aContent, &state, gWAIUnivStateMap[index]))
while (mozilla::a11y::aria::MapToState(gWAIUnivStateMap[index],
aElement, &state))
index++;
return state;

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

@ -41,7 +41,6 @@
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessible.h"
#include "nsOuterDocAccessible.h"
#include "nsRootAccessibleWrap.h"
#include "States.h"

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

@ -79,7 +79,6 @@
#include "nsNPAPIPluginInstance.h"
#include "nsISupportsUtils.h"
#include "nsObjectFrame.h"
#include "nsOuterDocAccessible.h"
#include "nsRootAccessibleWrap.h"
#include "nsTextFragment.h"
#include "mozilla/Services.h"
@ -110,6 +109,7 @@
#include "nsXFormsFormControlsAccessible.h"
#include "nsXFormsWidgetsAccessible.h"
#include "OuterDocAccessible.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
@ -210,9 +210,9 @@ already_AddRefed<nsAccessible>
nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
nsAccessible* accessible =
new nsOuterDocAccessible(aContent,
nsAccUtils::GetDocAccessibleFor(aPresShell));
nsAccessible* accessible =
new OuterDocAccessible(aContent,
nsAccUtils::GetDocAccessibleFor(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -1356,7 +1356,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
return nsnull;
if (type == nsIAccessibleProvider::OuterDoc) {
nsAccessible* accessible = new nsOuterDocAccessible(aContent, aDoc);
nsAccessible* accessible = new OuterDocAccessible(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}

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

@ -821,7 +821,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
// point. Skip offscreen or invisible accessibles. This takes care of cases
// where layout won't walk into things for us, such as image map areas and
// sub documents (XXX: subdocuments should be handled by methods of
// nsOuterDocAccessibles).
// OuterDocAccessibles).
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);
@ -1609,8 +1609,13 @@ nsAccessible::State()
void
nsAccessible::ApplyARIAState(PRUint64* aState)
{
if (!mContent->IsElement())
return;
dom::Element* element = mContent->AsElement();
// Test for universal states first
*aState |= nsARIAMap::UniversalStatesFor(mContent);
*aState |= nsARIAMap::UniversalStatesFor(element);
if (mRoleMapEntry) {
@ -1650,16 +1655,11 @@ nsAccessible::ApplyARIAState(PRUint64* aState)
return;
*aState |= mRoleMapEntry->state;
if (nsStateMapEntry::MapToStates(mContent, aState,
mRoleMapEntry->attributeMap1) &&
nsStateMapEntry::MapToStates(mContent, aState,
mRoleMapEntry->attributeMap2)) {
nsStateMapEntry::MapToStates(mContent, aState,
mRoleMapEntry->attributeMap3);
}
}
// Not implemented by this class
if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) &&
aria::MapToState(mRoleMapEntry->attributeMap2, element, aState))
aria::MapToState(mRoleMapEntry->attributeMap3, element, aState);
}
/* DOMString getValue (); */
NS_IMETHODIMP
@ -2825,9 +2825,9 @@ nsAccessible::IsSelect()
// accessible so that we can follow COM identity rules.
return mRoleMapEntry &&
(mRoleMapEntry->attributeMap1 == eARIAMultiSelectable ||
mRoleMapEntry->attributeMap2 == eARIAMultiSelectable ||
mRoleMapEntry->attributeMap3 == eARIAMultiSelectable);
(mRoleMapEntry->attributeMap1 == aria::eARIAMultiSelectable ||
mRoleMapEntry->attributeMap2 == aria::eARIAMultiSelectable ||
mRoleMapEntry->attributeMap3 == aria::eARIAMultiSelectable);
}
already_AddRefed<nsIArray>

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

@ -64,7 +64,6 @@ class nsHyperTextAccessible;
class nsHTMLImageAccessible;
class nsHTMLImageMapAccessible;
class nsHTMLLIAccessible;
struct nsRoleMapEntry;
class Relation;
namespace mozilla {
namespace a11y {

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

@ -0,0 +1,31 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_generic_s
LIBXUL_LIBRARY = 1
CPPSRCS = \
OuterDocAccessible.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../base \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \
$(NULL)

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

@ -36,43 +36,48 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsOuterDocAccessible.h"
#include "OuterDocAccessible.h"
#include "nsAccUtils.h"
#include "nsDocAccessible.h"
#include "Role.h"
#include "States.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsOuterDocAccessible
// OuterDocAccessible
////////////////////////////////////////////////////////////////////////////////
nsOuterDocAccessible::
nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
OuterDocAccessible::
OuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
nsAccessibleWrap(aContent, aDoc)
{
}
OuterDocAccessible::~OuterDocAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
NS_IMPL_ISUPPORTS_INHERITED0(OuterDocAccessible,
nsAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsAccessible public (DON'T add methods here)
role
nsOuterDocAccessible::NativeRole()
OuterDocAccessible::NativeRole()
{
return roles::INTERNAL_FRAME;
}
nsAccessible*
nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild)
OuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild)
{
PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0;
nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight);
@ -92,7 +97,7 @@ nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
}
nsresult
nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
OuterDocAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsAutoString tag;
aAttributes->GetStringProperty(NS_LITERAL_CSTRING("tag"), tag);
@ -108,14 +113,14 @@ nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
// nsIAccessible
PRUint8
nsOuterDocAccessible::ActionCount()
OuterDocAccessible::ActionCount()
{
// Internal frame, which is the doc's parent, should not have a click action.
return 0;
}
NS_IMETHODIMP
nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
OuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
aName.Truncate();
@ -123,7 +128,8 @@ nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
}
NS_IMETHODIMP
nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescription)
OuterDocAccessible::GetActionDescription(PRUint8 aIndex,
nsAString& aDescription)
{
aDescription.Truncate();
@ -131,7 +137,7 @@ nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescripti
}
NS_IMETHODIMP
nsOuterDocAccessible::DoAction(PRUint8 aIndex)
OuterDocAccessible::DoAction(PRUint8 aIndex)
{
return NS_ERROR_INVALID_ARG;
}
@ -140,7 +146,7 @@ nsOuterDocAccessible::DoAction(PRUint8 aIndex)
// nsAccessNode public
void
nsOuterDocAccessible::Shutdown()
OuterDocAccessible::Shutdown()
{
// XXX: sometimes outerdoc accessible is shutdown because of layout style
// change however the presshell of underlying document isn't destroyed and
@ -149,7 +155,7 @@ nsOuterDocAccessible::Shutdown()
NS_LOG_ACCDOCDESTROY_MSG("A11y outerdoc shutdown")
NS_LOG_ACCDOCDESTROY_ACCADDRESS("outerdoc", this)
nsAccessible *childAcc = mChildren.SafeElementAt(0, nsnull);
nsAccessible* childAcc = mChildren.SafeElementAt(0, nsnull);
if (childAcc) {
NS_LOG_ACCDOCDESTROY("outerdoc's child document shutdown",
childAcc->GetDocumentNode())
@ -163,7 +169,7 @@ nsOuterDocAccessible::Shutdown()
// nsAccessible public
void
nsOuterDocAccessible::InvalidateChildren()
OuterDocAccessible::InvalidateChildren()
{
// Do not invalidate children because nsAccDocManager is responsible for
// document accessible lifetime when DOM document is created or destroyed. If
@ -178,7 +184,7 @@ nsOuterDocAccessible::InvalidateChildren()
}
bool
nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
OuterDocAccessible::AppendChild(nsAccessible* aAccessible)
{
// We keep showing the old document for a bit after creating the new one,
// and while building the new DOM and frame tree. That's done on purpose
@ -199,9 +205,9 @@ nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
}
bool
nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
OuterDocAccessible::RemoveChild(nsAccessible* aAccessible)
{
nsAccessible *child = mChildren.SafeElementAt(0, nsnull);
nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
if (child != aAccessible) {
NS_ERROR("Wrong child to remove!");
return false;
@ -224,7 +230,7 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
// nsAccessible protected
void
nsOuterDocAccessible::CacheChildren()
OuterDocAccessible::CacheChildren()
{
// Request document accessible for the content document to make sure it's
// created. It will appended to outerdoc accessible children asynchronously.

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

@ -36,24 +36,28 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsOuterDocAccessible_H_
#define _nsOuterDocAccessible_H_
#ifndef MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
#define MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
#include "nsAccessibleWrap.h"
namespace mozilla {
namespace a11y {
/**
* Used for <browser>, <frame>, <iframe>, <page> or editor> elements.
*
* In these variable names, "outer" relates to the nsOuterDocAccessible as
* In these variable names, "outer" relates to the OuterDocAccessible as
* opposed to the nsDocAccessibleWrap which is "inner". The outer node is
* a something like tags listed above, whereas the inner node corresponds to
* the inner document root.
*/
class nsOuterDocAccessible : public nsAccessibleWrap
class OuterDocAccessible : public nsAccessibleWrap
{
public:
nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
OuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
virtual ~OuterDocAccessible();
NS_DECL_ISUPPORTS_INHERITED
@ -83,4 +87,7 @@ protected:
virtual void CacheChildren();
};
} // namespace a11y
} // namespace mozilla
#endif

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

@ -432,7 +432,7 @@ nsHTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState)
{
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
nsStateMapEntry::MapToStates(mContent, aState, eARIAAutoComplete);
aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
}
PRUint64

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

@ -148,9 +148,6 @@ GetObjectOrRepresentedView(id <mozAccessible> aObject)
*/
- (void)appendChild:(nsAccessible*)aAccessible;
// invalidates the cached parent, used by invalidateChildren.
- (void)invalidateParent;
// makes ourselves "expired". after this point, we might be around if someone
// has retained us (e.g., a third-party), but we really contain no information.
- (void)expire;

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

@ -354,14 +354,11 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (mParent)
return mParent;
nsAccessible* accessibleParent = mGeckoAccessible->GetUnignoredParent();
if (accessibleParent) {
id nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
if (nativeParent)
return mParent = GetClosestInterestingAccessible(nativeParent);
return GetClosestInterestingAccessible(nativeParent);
}
// GetUnignoredParent() returns null when there is no unignored accessible all the way up to
@ -373,7 +370,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
id nativeParent = GetNativeFromGeckoAccessible(static_cast<nsIAccessible*>(root));
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
return mParent = GetClosestInterestingAccessible(nativeParent);
return GetClosestInterestingAccessible(nativeParent);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
@ -615,8 +612,6 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
[mChildren makeObjectsPerformSelector:@selector(invalidateParent)];
// make room for new children
[mChildren release];
mChildren = nil;
@ -635,11 +630,6 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
[mChildren addObject:GetObjectOrRepresentedView(curNative)];
}
- (void)invalidateParent
{
mParent = nil;
}
- (void)expire
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

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

@ -142,7 +142,7 @@ static const NSString* AXRoles [] = {
NSAccessibilityGroupRole, // roles::FOOTER 97
NSAccessibilityGroupRole, // roles::PARAGRAPH 98
@"AXRuler", // roles::RULER 99 10.4+ only, so we re-define the constant.
NSAccessibilityComboBoxRole, // roles::AUTOCOMPLETE 100
NSAccessibilityUnknownRole, // roles::AUTOCOMPLETE 100
NSAccessibilityTextFieldRole, // roles::EDITBAR 101
NSAccessibilityTextFieldRole, // roles::ENTRY 102
NSAccessibilityStaticTextRole, // roles::CAPTION 103

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

@ -754,7 +754,7 @@ nsXULTextFieldAccessible::ApplyARIAState(PRUint64* aState)
{
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
nsStateMapEntry::MapToStates(mContent, aState, eARIAAutoComplete);
aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
}

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

@ -101,7 +101,7 @@ _TEST_FILES =\
test_descr.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \
test_nsOuterDocAccessible.html \
test_OuterDocAccessible.html \
test_role_nsHyperTextAcc.html \
test_textboxes.html \
test_textboxes.xul \

1
aclocal.m4 поставляемый
Просмотреть файл

@ -7,7 +7,6 @@ builtin(include, build/autoconf/glib.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/nss.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/freetype2.m4)dnl
builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl

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

@ -307,6 +307,7 @@ pref("ui.dragThresholdY", 25);
// Layers Acceleration
pref("layers.acceleration.disabled", false);
pref("layers.offmainthreadcomposition.enabled", false);
// Web Notifications
pref("notification.feature.enabled", true);

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

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1332870813000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1333739604000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
@ -187,17 +187,15 @@
<pluginItems>
<pluginItem blockID="p28">
<match name="filename" exp="NPFFAddOn.dll" /> <versionRange >
</versionRange>
</pluginItem>
<match name="filename" exp="NPFFAddOn.dll" /> </pluginItem>
<pluginItem blockID="p31">
<match name="filename" exp="NPMySrch.dll" /> <versionRange >
</versionRange>
</pluginItem>
<match name="filename" exp="NPMySrch.dll" /> </pluginItem>
<pluginItem blockID="p33">
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1">
</versionRange>
</pluginItem>
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1"></versionRange>
</pluginItem>
<pluginItem blockID="p80">
<match name="description" exp="[^\d\._]((0(\.\d+(\.\d+([_\.]\d+)?)?)?)|(1\.(([0-5](\.\d+([_\.]\d+)?)?)|(6(\.0([_\.](0?\d|1\d|2\d|30))?)?)|(7(\.0([_\.][0-2])?)?))))([^\d\._]|$)" /> <match name="filename" exp="(npjp2\.dll)|(libnpjp2\.so)" /> <versionRange severity="1"></versionRange>
</pluginItem>
</pluginItems>
<gfxItems>
@ -210,6 +208,16 @@
</devices>
<feature>DIRECT3D_9_LAYERS</feature> <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus> <driverVersion>8.17.12.5896</driverVersion> <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator> </gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g37"> <os>WINNT 5.1</os> <vendor>0x10de</vendor> <feature>DIRECT3D_9_LAYERS</feature> <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus> <driverVersion>7.0.0.0</driverVersion> <driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator> </gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g81"> <os>WINNT 6.1</os> <vendor>0x1002</vendor> <devices>
<device>0x9802</device>
<device>0x9803</device>
<device>0x9803</device>
<device>0x9804</device>
<device>0x9805</device>
<device>0x9806</device>
<device>0x9807</device>
</devices>
<feature>DIRECT2D</feature> <featureStatus>BLOCKED_DEVICE</featureStatus> <driverVersion>1.0.0.0</driverVersion> <driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator> </gfxBlacklistEntry>
</gfxItems>

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

@ -507,7 +507,7 @@ function HistoryMenu(aPopupShowingEvent) {
"@mozilla.org/browser/sessionstore;1",
"nsISessionStore");
PlacesMenu.call(this, aPopupShowingEvent,
"place:redirectsMode=2&sort=4&maxResults=15");
"place:sort=4&maxResults=15");
}
HistoryMenu.prototype = {

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

@ -83,10 +83,7 @@ Site.prototype = {
* when done.
*/
block: function Site_block() {
if (gBlockedLinks.isBlocked(this._link)) {
if (aCallback)
aCallback();
} else {
if (!gBlockedLinks.isBlocked(this._link)) {
gBlockedLinks.block(this._link);
gUpdater.updateGrid();
}

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

@ -47,6 +47,8 @@
white-space: pre-wrap;
}
.expander[hidden],
.expander[hidden] + *,
.expander[collapsed] + * {
display: none;
}

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

@ -126,10 +126,8 @@
// Disallow overrides if this is a Strict-Transport-Security
// host and the cert is bad (STS Spec section 7.3) or if the
// certerror is in a frame (bug 633691).
if (getCSSClass() == "badStsCert" || window != top) {
var ec = document.getElementById('expertContent');
ec.parentNode.removeChild(ec);
}
if (getCSSClass() == "badStsCert" || window != top)
document.getElementById("expertContent").setAttribute("hidden", "true");
var tech = document.getElementById("technicalContentText");
if (tech)

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

@ -1352,7 +1352,7 @@ BrowserGlue.prototype = {
// be set to the version it has been added in, we will compare its value
// to users' smartBookmarksVersion and add new smart bookmarks without
// recreating old deleted ones.
const SMART_BOOKMARKS_VERSION = 3;
const SMART_BOOKMARKS_VERSION = 4;
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
@ -1380,9 +1380,7 @@ BrowserGlue.prototype = {
let smartBookmarks = {
MostVisited: {
title: bundle.GetStringFromName("mostVisitedTitle"),
uri: NetUtil.newURI("place:redirectsMode=" +
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET +
"&sort=" +
uri: NetUtil.newURI("place:sort=" +
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=" + MAX_RESULTS),
parent: PlacesUtils.toolbarFolderId,

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

@ -733,6 +733,8 @@ PlacesViewBase.prototype = {
.direction == "rtl";
},
get ownerWindow() window,
/**
* Adds an "Open All in Tabs" menuitem to the bottom of the popup.
* @param aPopup

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

@ -336,7 +336,7 @@ var PlacesOrganizer = {
// The command execution function will take care of seeing if the
// selection is a folder or a different container type, and will
// load its contents in tabs.
PlacesUIUtils.openContainerNodeInTabs(selectedNode, aEvent);
PlacesUIUtils.openContainerNodeInTabs(selectedNode, aEvent, currentView);
}
}
},
@ -363,7 +363,7 @@ var PlacesOrganizer = {
openSelectedNode: function PO_openSelectedNode(aEvent) {
PlacesUIUtils.openNodeWithEvent(this._content.selectedNode, aEvent,
this._content.treeBoxObject.view);
this._content);
},
/**

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

@ -86,7 +86,7 @@ var SidebarUtils = {
else if (!mouseInGutter && openInTabs &&
aEvent.originalTarget.localName == "treechildren") {
tbo.view.selection.select(row.value);
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, tbo.view);
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, aTree);
}
else if (!mouseInGutter && !isContainer &&
aEvent.originalTarget.localName == "treechildren") {
@ -94,7 +94,7 @@ var SidebarUtils = {
// do this *before* attempting to load the link since openURL uses
// selection as an indication of which link to load.
tbo.view.selection.select(row.value);
PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent, tbo.view);
PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent, aTree);
}
},

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

@ -699,6 +699,10 @@
this._contextMenuShown = false;
<body/>
</method>
<property name="ownerWindow"
readonly="true"
onget="return window;"/>
</implementation>
<handlers>
<handler event="focus"><![CDATA[

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

@ -377,12 +377,6 @@ var PlacesUIUtils = {
*/
showBookmarkDialog:
function PUIU_showBookmarkDialog(aInfo, aParentWindow, aResizable) {
// This is a compatibility shim for add-ons. It will warn in the Error
// Console when used.
if (!aParentWindow) {
aParentWindow = this._getWindow(null);
}
// Preserve size attributes differently based on the fact the dialog has
// a folder picker or not. If the picker is visible, the dialog should
// be resizable since it may not show enough content for the folders
@ -621,44 +615,9 @@ var PlacesUIUtils = {
browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);
},
/**
* Helper method for methods which are forced to take a view/window
* parameter as an optional parameter. It will be removed post Fx4.
*/
_getWindow: function PUIU__getWindow(aView) {
if (aView) {
// Pratically, this is the case for places trees.
if (aView instanceof Components.interfaces.nsIDOMNode)
return aView.ownerDocument.defaultView;
return Cu.getGlobalForObject(aView);
}
let caller = arguments.callee.caller;
// If a view wasn't expected, the method should have got a window.
if (aView === null) {
Components.utils.reportError("The api has changed. A window should be " +
"passed to " + caller.name + ". Not " +
"passing a window will throw in a future " +
"release.");
}
else {
Components.utils.reportError("The api has changed. A places view " +
"should be passed to " + caller.name + ". " +
"Not passing a view will throw in a future " +
"release.");
}
// This could certainly break in some edge cases (like bug 562998), but
// that's the best we should do for those extreme backwards-compatibility cases.
let topBrowserWin = this._getTopBrowserWin();
return topBrowserWin ? topBrowserWin : focusManager.focusedWindow;
},
openContainerNodeInTabs:
function PUIU_openContainerInTabs(aNode, aEvent, aView) {
let window = this._getWindow(aView);
let window = aView.ownerWindow;
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
if (!this._confirmOpenInTabs(urlsToOpen.length, window))
@ -668,7 +627,7 @@ var PlacesUIUtils = {
},
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
let window = this._getWindow(aView);
let window = aView.ownerWindow;
let urlsToOpen = [];
for (var i=0; i < aNodes.length; i++) {
@ -693,7 +652,7 @@ var PlacesUIUtils = {
*/
openNodeWithEvent:
function PUIU_openNodeWithEvent(aNode, aEvent, aView) {
let window = this._getWindow(aView);
let window = aView.ownerWindow;
this._openNodeIn(aNode, window.whereToOpenLink(aEvent), window);
},
@ -703,7 +662,7 @@ var PlacesUIUtils = {
* see also openUILinkIn
*/
openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aView) {
let window = this._getWindow(aView);
let window = aView.ownerWindow;
this._openNodeIn(aNode, aWhere, window);
},

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

@ -102,7 +102,7 @@ let (backup_date = new Date().toLocaleFormat("%Y-%m-%d")) {
}
// Smart bookmarks constants.
const SMART_BOOKMARKS_VERSION = 3;
const SMART_BOOKMARKS_VERSION = 4;
const SMART_BOOKMARKS_ON_TOOLBAR = 1;
const SMART_BOOKMARKS_ON_MENU = 3; // Takes in count the additional separator.

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

@ -45,6 +45,7 @@ do_check_eq(typeof PlacesUtils, "object");
// main
function run_test() {
do_test_pending();
/*
HTML+FEATURES SUMMARY:
- import legacy bookmarks
@ -61,8 +62,7 @@ function run_test() {
Cu.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
// avoid creating the places smart folder during tests
Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).
setIntPref("browser.places.smartBookmarksVersion", -1);
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", -1);
// file pointer to legacy bookmarks file
//var bookmarksFileOld = do_get_file("bookmarks.large.html");
@ -80,41 +80,43 @@ function run_test() {
// Test importing a pre-Places canonical bookmarks file.
// 1. import bookmarks.preplaces.html
// 2. run the test-suite
// Note: we do not empty the db before this import to catch bugs like 380999
try {
BookmarkHTMLUtils.importFromFile(bookmarksFileOld, true, after_import);
} catch(ex) { do_throw("couldn't import legacy bookmarks file: " + ex); }
}
function after_import(success) {
if (!success) {
do_throw("Couldn't import legacy bookmarks file.");
}
populate();
validate();
function after_import(success) {
if (!success) {
do_throw("Couldn't import legacy bookmarks file.");
}
waitForAsyncUpdates(function () {
// Test exporting a Places canonical json file.
// 1. export to bookmarks.exported.json
// 2. empty bookmarks db
// 3. import bookmarks.exported.json
// 4. run the test-suite
try {
var jsonFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
jsonFile.append("bookmarks.exported.json");
PlacesUtils.backups.saveBookmarksToJSONFile(jsonFile);
} catch(ex) { do_throw("couldn't export to file: " + ex); }
LOG("exported json");
try {
PlacesUtils.restoreBookmarksFromJSONFile(jsonFile);
} catch(ex) { do_throw("couldn't import the exported file: " + ex); }
LOG("imported json");
populate();
// 2. run the test-suite
validate();
LOG("validated import");
waitForAsyncUpdates(function testJsonExport() {
// Test exporting a Places canonical json file.
// 1. export to bookmarks.exported.json
try {
PlacesUtils.backups.saveBookmarksToJSONFile(jsonFile);
} catch(ex) { do_throw("couldn't export to file: " + ex); }
LOG("exported json");
waitForAsyncUpdates(do_test_finished);
});
// 2. empty bookmarks db
// 3. import bookmarks.exported.json
try {
PlacesUtils.restoreBookmarksFromJSONFile(jsonFile);
} catch(ex) { do_throw("couldn't import the exported file: " + ex); }
LOG("imported json");
// 4. run the test-suite
validate();
LOG("validated import");
waitForAsyncUpdates(do_test_finished);
});
}
}
var tagData = [

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

@ -74,8 +74,6 @@ let gTests = [
// Set preferences.
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces().
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been imported, and a smart bookmark has been
// created.
@ -87,6 +85,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces().
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
@ -107,8 +107,6 @@ let gTests = [
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces().
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
@ -120,6 +118,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces().
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
@ -141,8 +141,6 @@ let gTests = [
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
@ -155,6 +153,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
@ -176,8 +176,6 @@ let gTests = [
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
@ -191,6 +189,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
@ -210,8 +210,6 @@ let gTests = [
// Set preferences.
Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been restored.
itemId =
@ -223,6 +221,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
@ -244,8 +244,6 @@ let gTests = [
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
waitForImportAndSmartBookmarks(function () {
// Check bookmarks.html has been restored.
itemId =
@ -258,6 +256,8 @@ let gTests = [
run_next_test();
});
// Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);

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

@ -11,6 +11,11 @@ ac_add_options --enable-js-diagnostics
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# PGO
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'

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

@ -11,6 +11,11 @@ ac_add_options --enable-js-diagnostics
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# PGO
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'

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

@ -20,62 +20,80 @@ var gScripts = null;
function test()
{
let scriptShown = false;
let framesAdded = false;
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.debuggerWindow;
testScriptsDisplay();
gPane.activeThread.addOneTimeListener("framesadded", function() {
framesAdded = true;
runTest();
});
gDebuggee.firstCall();
});
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("-02.js") != -1) {
scriptShown = true;
window.removeEventListener(aEvent.type, _onEvent);
runTest();
}
});
function runTest()
{
if (scriptShown && framesAdded) {
Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
}
}
}
function testScriptsDisplay() {
gPane.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
gScripts = gDebugger.DebuggerView.Scripts._scripts;
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
for (let i = 0; i < gScripts.itemCount; i++) {
info("label: " + i + " " + gScripts.getItemAtIndex(i).getAttribute("label"));
}
for (let i = 0; i < gScripts.itemCount; i++) {
info("label: " + i + " " + gScripts.getItemAtIndex(i).getAttribute("label"));
}
let label1 = "test-script-switching-01.js";
let label2 = "test-script-switching-02.js";
let label1 = "test-script-switching-01.js";
let label2 = "test-script-switching-02.js";
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
label1), "First script url is incorrect.");
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
label2), "Second script url is incorrect.");
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
label1), "First script url is incorrect.");
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
label2), "Second script url is incorrect.");
ok(gDebugger.DebuggerView.Scripts.containsLabel(
label1), "First script label is incorrect.");
ok(gDebugger.DebuggerView.Scripts.containsLabel(
label2), "Second script label is incorrect.");
ok(gDebugger.DebuggerView.Scripts.containsLabel(
label1), "First script label is incorrect.");
ok(gDebugger.DebuggerView.Scripts.containsLabel(
label2), "Second script label is incorrect.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
is(gDebugger.editor.getDebugLocation(), 5,
"editor debugger location is correct.");
is(gDebugger.editor.getDebugLocation(), 5,
"editor debugger location is correct.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onChange);
testSwitchPaused();
});
gScripts.selectedIndex = 0;
gDebugger.SourceScripts.onChange({ target: gScripts });
}}, 0);
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("-01.js") != -1) {
window.removeEventListener(aEvent.type, _onEvent);
testSwitchPaused();
}
});
gDebuggee.firstCall();
gDebugger.DebuggerView.Scripts.selectScript(EXAMPLE_URL + label1);
}
function testSwitchPaused()
@ -90,14 +108,16 @@ function testSwitchPaused()
"editor debugger location has been cleared.");
gDebugger.StackFrames.activeThread.resume(function() {
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onSecondChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onSecondChange);
testSwitchRunning();
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("-02.js") != -1) {
window.removeEventListener(aEvent.type, _onEvent);
testSwitchRunning();
}
});
gScripts.selectedIndex = 1;
gDebugger.SourceScripts.onChange({ target: gScripts });
gDebugger.DebuggerView.Scripts.selectScript(EXAMPLE_URL +
"test-script-switching-02.js");
});
}

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

@ -20,44 +20,63 @@ var gScripts = null;
function test()
{
let scriptShown = false;
let framesAdded = false;
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.debuggerWindow;
testScriptsDisplay();
gPane.activeThread.addOneTimeListener("framesadded", function() {
framesAdded = true;
runTest();
});
gDebuggee.firstCall();
});
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("editor-mode") != -1) {
scriptShown = true;
window.removeEventListener(aEvent.type, _onEvent);
runTest();
}
});
function runTest()
{
if (scriptShown && framesAdded) {
Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
}
}
}
function testScriptsDisplay() {
gPane.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
gScripts = gDebugger.DebuggerView.Scripts._scripts;
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
is(gDebugger.editor.getMode(), SourceEditor.MODES.HTML,
"Found the expected editor mode.");
is(gDebugger.editor.getMode(), SourceEditor.MODES.HTML,
"Found the expected editor mode.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onChange);
testSwitchPaused();
});
gScripts.selectedIndex = 0;
gDebugger.SourceScripts.onChange({ target: gScripts });
}}, 0);
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("switching-01.js") != -1) {
window.removeEventListener(aEvent.type, _onEvent);
testSwitchPaused();
}
});
gDebuggee.firstCall();
let url = gDebuggee.document.querySelector("script").src;
gDebugger.DebuggerView.Scripts.selectScript(url);
}
function testSwitchPaused()

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

@ -153,15 +153,19 @@ const DEFAULT_KEYBINDINGS = [
alt: true,
},
{
action: "Comment",
action: "Comment/Uncomment",
code: Ci.nsIDOMKeyEvent.DOM_VK_SLASH,
accel: true,
},
{
action: "Uncomment",
code: Ci.nsIDOMKeyEvent.DOM_VK_SLASH,
action: "Move to Bracket Opening",
code: Ci.nsIDOMKeyEvent.DOM_VK_OPEN_BRACKET,
accel: true,
},
{
action: "Move to Bracket Closing",
code: Ci.nsIDOMKeyEvent.DOM_VK_CLOSE_BRACKET,
accel: true,
shift: true,
},
];
@ -403,8 +407,9 @@ SourceEditor.prototype = {
"Find Previous Occurrence": [this.ui.findPrevious, this.ui],
"Goto Line...": [this.ui.gotoLine, this.ui],
"Move Lines Down": [this._moveLines, this],
"Comment": [this._doComment, this],
"Uncomment": [this._doUncomment, this],
"Comment/Uncomment": [this._doCommentUncomment, this],
"Move to Bracket Opening": [this._moveToBracketOpening, this],
"Move to Bracket Closing": [this._moveToBracketClosing, this],
};
for (let name in actions) {
@ -1050,6 +1055,63 @@ SourceEditor.prototype = {
return {line: line, blockStart: blockCommentStart, blockEnd: blockCommentEnd};
},
/**
* Decide whether to comment the selection/current line or to uncomment it.
*
* @private
*/
_doCommentUncomment: function SE__doCommentUncomment()
{
if (this.readOnly) {
return false;
}
let commentObject = this._getCommentStrings();
if (!commentObject) {
return false;
}
let selection = this.getSelection();
let model = this._model;
let firstLine = model.getLineAtOffset(selection.start);
let lastLine = model.getLineAtOffset(selection.end);
// Checks for block comment.
let firstLineText = model.getLine(firstLine);
let lastLineText = model.getLine(lastLine);
let openIndex = firstLineText.indexOf(commentObject.blockStart);
let closeIndex = lastLineText.lastIndexOf(commentObject.blockEnd);
if (openIndex != -1 && closeIndex != -1 &&
(firstLine != lastLine ||
(closeIndex - openIndex) >= commentObject.blockStart.length)) {
return this._doUncomment();
}
if (!commentObject.line) {
return this._doComment();
}
// If the selection is not a block comment, check for the first and the last
// lines to be line commented.
let firstLastCommented = [firstLineText,
lastLineText].every(function(aLineText) {
let openIndex = aLineText.indexOf(commentObject.line);
if (openIndex != -1) {
let textUntilComment = aLineText.slice(0, openIndex);
if (!textUntilComment || /^\s+$/.test(textUntilComment)) {
return true;
}
}
return false;
});
if (firstLastCommented) {
return this._doUncomment();
}
// If we reach here, then we have to comment the selection/line.
return this._doComment();
},
/**
* Wrap the selected text in comments. If nothing is selected the current
* caret line is commented out. Single line and block comments depend on the
@ -1123,7 +1185,9 @@ SourceEditor.prototype = {
let lastLineText = this._model.getLine(lastLine);
let openIndex = firstLineText.indexOf(commentObject.blockStart);
let closeIndex = lastLineText.lastIndexOf(commentObject.blockEnd);
if (openIndex != -1 && closeIndex != -1) {
if (openIndex != -1 && closeIndex != -1 &&
(firstLine != lastLine ||
(closeIndex - openIndex) >= commentObject.blockStart.length)) {
let firstLineStartOffset = this.getLineStart(firstLine);
let lastLineStartOffset = this.getLineStart(lastLine);
let openOffset = firstLineStartOffset + openIndex;
@ -1161,6 +1225,99 @@ SourceEditor.prototype = {
return true;
},
/**
* Helper function for _moveToBracket{Opening/Closing} to find the offset of
* matching bracket.
*
* @param number aOffset
* The offset of the bracket for which you want to find the bracket.
* @private
*/
_getMatchingBracketIndex: function SE__getMatchingBracketIndex(aOffset)
{
return this._styler._findMatchingBracket(this._model, aOffset);
},
/**
* Move the cursor to the matching opening bracket if at corresponding closing
* bracket, otherwise move to the opening bracket for the current block of code.
*
* @private
*/
_moveToBracketOpening: function SE__moveToBracketOpening()
{
let mode = this.getMode();
// Returning early if not in JavaScipt or CSS mode.
if (mode != SourceEditor.MODES.JAVASCRIPT &&
mode != SourceEditor.MODES.CSS) {
return false;
}
let caretOffset = this.getCaretOffset() - 1;
let matchingIndex = this._getMatchingBracketIndex(caretOffset);
// If the caret is not at the closing bracket "}", find the index of the
// opening bracket "{" for the current code block.
if (matchingIndex == -1 || matchingIndex > caretOffset) {
let text = this.getText();
let closingOffset = text.indexOf("}", caretOffset);
while (closingOffset > -1) {
let closingMatchingIndex = this._getMatchingBracketIndex(closingOffset);
if (closingMatchingIndex < caretOffset && closingMatchingIndex != -1) {
matchingIndex = closingMatchingIndex;
break;
}
closingOffset = text.indexOf("}", closingOffset + 1);
}
}
if (matchingIndex > -1) {
this.setCaretOffset(matchingIndex);
}
return true;
},
/**
* Moves the cursor to the matching closing bracket if at corresponding opening
* bracket, otherwise move to the closing bracket for the current block of code.
*
* @private
*/
_moveToBracketClosing: function SE__moveToBracketClosing()
{
let mode = this.getMode();
// Returning early if not in JavaScipt or CSS mode.
if (mode != SourceEditor.MODES.JAVASCRIPT &&
mode != SourceEditor.MODES.CSS) {
return false;
}
let caretOffset = this.getCaretOffset();
let matchingIndex = this._getMatchingBracketIndex(caretOffset - 1);
// If the caret is not at the opening bracket "{", find the index of the
// closing bracket "}" for the current code block.
if (matchingIndex == -1 || matchingIndex < caretOffset) {
let text = this.getText();
let openingOffset = text.lastIndexOf("{", caretOffset);
while (openingOffset > -1) {
let openingMatchingIndex = this._getMatchingBracketIndex(openingOffset);
if (openingMatchingIndex > caretOffset) {
matchingIndex = openingMatchingIndex;
break;
}
openingOffset = text.lastIndexOf("{", openingOffset - 1);
}
}
if (matchingIndex > -1) {
this.setCaretOffset(matchingIndex);
}
return true;
},
/**
* Add an event listener to the editor. You can use one of the known events.
*

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

@ -63,6 +63,7 @@ _BROWSER_TEST_FILES = \
browser_bug729480_line_vertical_align.js \
browser_bug725430_comment_uncomment.js \
browser_bug731721_debugger_stepping.js \
browser_bug729960_block_bracket_jump.js \
head.js \
libs:: $(_BROWSER_TEST_FILES)

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

@ -48,7 +48,7 @@ function test() {
editor.redo();
is(editor.getText(), "//" + text, "Redo works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "JS Single Line Uncommenting works");
editor.setText(text);
@ -61,18 +61,18 @@ function test() {
editor.redo();
is(editor.getText(), "/*" + text + "*/", "Redo works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "JS Block Uncommenting works");
editor.undo();
is(editor.getText(), "/*" + text + "*/", "Undo Block Uncommenting works");
editor.redo();
is(editor.getText(), text, "Redo works");
let regText = "//firstline\n // secondline\nthird//line\nfourthline//";
let expText = "firstline\n secondline\nthird//line\nfourthline//";
let regText = "//firstline\n // secondline\nthird//line\n//fourthline";
let expText = "firstline\n secondline\nthird//line\nfourthline";
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "JS Multiple Line Uncommenting works");
editor.undo();
is(editor.getText(), regText, "Undo Multiple Line Uncommenting works");
@ -87,7 +87,7 @@ function test() {
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "CSS Commenting without selection works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "CSS Uncommenting without selection works");
editor.setText(text);
@ -96,7 +96,7 @@ function test() {
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "/*" + text + "*/", "CSS Multiple Line Commenting works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "CSS Multiple Line Uncommenting works");
editor.setMode(SourceEditor.MODES.HTML);
@ -107,7 +107,7 @@ function test() {
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "HTML Commenting without selection works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "HTML Uncommenting without selection works");
editor.setText(text);
@ -116,7 +116,7 @@ function test() {
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "<!--" + text + "-->", "HTML Multiple Line Commenting works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "HTML Multiple Line Uncommenting works");
editor.setMode(SourceEditor.MODES.TEXT);
@ -125,10 +125,10 @@ function test() {
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "Commenting disabled in Text mode");
editor.setText("//" + text);
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
is(editor.getText(), "//" + text, "Uncommenting disabled in Text mode");
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), regText, "Uncommenting disabled in Text mode");
editor.setText(text);
editor.readOnly = true;
@ -136,10 +136,10 @@ function test() {
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "Commenting disabled in ReadOnly mode");
editor.setText("//" + text);
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true, shiftKey: true}, testWin);
is(editor.getText(), "//" + text, "Uncommenting disabled in ReadOnly mode");
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), regText, "Uncommenting disabled in ReadOnly mode");
editor.destroy();

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

@ -0,0 +1,164 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 729960' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let JSText = "function foo(aVar) {\n" +
" // Block Level 1\n\n" +
" function level2() {\n" +
" let baz = aVar;\n" +
" // Block Level 2\n" +
" function level3() {\n" +
" // Block Level 3\n" +
" }\n" +
" }\n" +
" // Block Level 1" +
" function bar() { /* Block Level 2 */ }\n" +
"}";
editor.setMode(SourceEditor.MODES.JAVASCRIPT);
editor.setText(JSText);
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(19);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 19,
"JS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 10 start.
editor.setCaretOffset(161);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 19,
"JS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(161);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of code block when inside the function");
// Setting caret at Line 6 start.
editor.setCaretOffset(67);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 159,
"JS : Jump to closing bracket in a nested function with caret inside");
editor.setCaretOffset(67);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 61,
"JS : Jump to opening bracket in a nested function with caret inside");
let CSSText = "#object {\n" +
" property: value;\n" +
" /* comment */\n" +
"}";
editor.setMode(SourceEditor.MODES.CSS);
editor.setText(CSSText);
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(8);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 8,
"CSS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 3 start.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 8,
"CSS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(28);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of code block when inside the function");
let HTMLText = "<html>\n" +
" <head>\n" +
" <title>Testing Block Jump</title>\n" +
" </head>\n" +
" <body></body>\n" +
"</html>";
editor.setMode(SourceEditor.MODES.HTML);
editor.setText(HTMLText);
// Setting caret at Line 1 end.
editor.setCaretOffset(6);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 6,
"HTML : Jump to block end : Nothing happens in html mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(64);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 64,
"HTML : Jump to block start : Nothing happens in html mode");
let text = "line 1\n" +
"line 2\n" +
"line 3\n" +
"line 4\n";
editor.setMode(SourceEditor.MODES.TEXT);
editor.setText(text);
// Setting caret at Line 1 start.
editor.setCaretOffset(0);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 0,
"Text : Jump to block end : Nothing happens in text mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
is(editor.getCaretOffset(), 28,
"Text : Jump to block start : Nothing happens in text mode");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

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

@ -1177,7 +1177,8 @@ function setupBracketCompletion(aSourceEditor)
editorElement.addEventListener("keypress", function onKeyPress(aEvent) {
let pair = pairs[aEvent.charCode];
if (!pair) {
if (!pair || aEvent.ctrlKey || aEvent.metaKey ||
aEvent.accelKey || aEvent.altKey) {
return true;
}

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

@ -90,6 +90,14 @@ function testEditorAdded(aChrome, aEditor)
is(computedStyle.backgroundColor, "rgb(255, 255, 255)",
"content's background color is initially white");
EventUtils.synthesizeKey("[", {accelKey: true}, gChromeWindow);
is(aEditor.sourceEditor.getText(), "",
"Nothing happened as it is a known shortcut in source editor");
EventUtils.synthesizeKey("]", {accelKey: true}, gChromeWindow);
is(aEditor.sourceEditor.getText(), "",
"Nothing happened as it is a known shortcut in source editor");
for each (let c in TESTCASE_CSS_SOURCE) {
EventUtils.synthesizeKey(c, {}, gChromeWindow);
}

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

@ -432,9 +432,6 @@ let PlacesProvider = {
// Sort by frecency, descending.
options.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_FRECENCY_DESCENDING
// We don't want source redirects for this query.
options.redirectsMode = Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET;
let links = [];
let callback = {

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

@ -477,8 +477,6 @@ var WinTaskbarJumpList =
var options = PlacesUtils.history.getNewQueryOptions();
options.maxResults = aLimit;
options.sortingMode = aSortingMode;
// We don't want source redirects for these queries.
options.redirectsMode = Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET;
var query = PlacesUtils.history.getNewQuery();
// Return the pending statement to the caller, to allow cancelation.

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

@ -1,137 +0,0 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
dnl AM_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
dnl
AC_DEFUN([AC_CHECK_FT2],
[dnl
dnl Get the cflags and libraries from the freetype-config script
dnl
AC_ARG_WITH(freetype-prefix,
[ --with-ft-prefix=PFX Prefix where FreeType is installed (optional)],
ft_config_prefix="$withval", ft_config_prefix="")
AC_ARG_WITH(freetype-exec-prefix,
[ --with-ft-exec-prefix=PFX
Exec prefix where FreeType is installed (optional)],
ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
AC_ARG_ENABLE(freetypetest,
[ --disable-freetypetest
Do not try to compile and run a test FreeType program],
[], enable_fttest=yes)
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
min_ft_version=ifelse([$1], ,6.1.0,$1)
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_fttest" = "xyes" ; then
ft_config_is_lt=no
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test "x$ft_config_is_lt" = "xyes" ; then
ifelse([$3], , :, [$3])
AC_MSG_RESULT(no)
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
dnl
dnl Sanity checks for the results of freetype-config to some extent
dnl
AC_TRY_RUN([
#include <ft2build.h>
#include FT_FREETYPE_H
#include <stdio.h>
#include <stdlib.h>
int
main()
{
FT_Library library;
FT_Error error;
error = FT_Init_FreeType(&library);
if (error)
return 1;
else
{
FT_Done_FreeType(library);
return 0;
}
}
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test "x$enable_fttest" = "xyes"
fi # test "$FT2_CONFIG" = "no"
if test "x$ft_config_is_lt" != "xyes" ; then
if test "x$no_ft" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$FT2_CONFIG" = "no" ; then
echo "*** The freetype-config script installed by FreeType 2 could not be found."
echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the FT2_CONFIG environment variable to the"
echo "*** full path to freetype-config."
else
echo "*** The FreeType test program failed to run. If your system uses"
echo "*** shared libraries and they are installed outside the normal"
echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
echo "*** (or whatever is appropiate for your system) is correctly set."
fi
FT2_CFLAGS=""
FT2_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(FT2_CFLAGS)
AC_SUBST(FT2_LIBS)
fi
])

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

@ -67,7 +67,6 @@ MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
APPNAME = $(MOZ_MACBUNDLE_NAME)
INSTALLER_DIR = $(MOZ_BUILD_APP)/installer
ifeq ($(MOZ_BUILD_APP),xulrunner) # {
INSTALLER_DIR = xulrunner/installer/mac
APPNAME = XUL.framework
APP_CONTENTS = Versions/Current
endif # } xulrunner

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

@ -7,8 +7,8 @@ import tempfile
class DeviceManagerADB(DeviceManager):
def __init__(self, host=None, port=20701, retrylimit=5, packageName=None,
adbPath='adb'):
def __init__(self, host=None, port=20701, retrylimit=5, packageName='fennec',
adbPath='adb', deviceSerial=None):
self.host = host
self.port = port
self.retrylimit = retrylimit
@ -24,13 +24,17 @@ class DeviceManagerADB(DeviceManager):
# the path to adb, or 'adb' to assume that it's on the PATH
self.adbPath = adbPath
if packageName:
self.packageName = packageName
else:
# The serial number of the device to use with adb, used in cases
# where multiple devices are being managed by the same adb instance.
self.deviceSerial = deviceSerial
if packageName == 'fennec':
if os.getenv('USER'):
self.packageName = 'org.mozilla.fennec_' + os.getenv('USER')
else:
self.packageName = 'org.mozilla.fennec_'
elif packageName:
self.packageName = packageName
# verify that we can run the adb command. can't continue otherwise
self.verifyADB()
@ -100,7 +104,11 @@ class DeviceManagerADB(DeviceManager):
cmdline = envstr + "; " + cmdline
# all output should be in stdout
proc = subprocess.Popen([self.adbPath, "shell", cmdline],
args=[self.adbPath]
if self.deviceSerial:
args.extend(['-s', self.deviceSerial])
args.extend(["shell", cmdline])
proc = subprocess.Popen(args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = proc.communicate()
outputfile.write(stdout.rstrip('\n'))
@ -153,7 +161,9 @@ class DeviceManagerADB(DeviceManager):
# failure: None
def mkDir(self, name):
try:
self.checkCmdAs(["shell", "mkdir", name])
result = self.runCmdAs(["shell", "mkdir", name]).stdout.read()
if 'read-only file system' in result.lower():
return None
self.chmodDir(name)
return name
except:
@ -527,10 +537,14 @@ class DeviceManagerADB(DeviceManager):
testRoot = "/data/local/tests"
if (self.dirExists(testRoot)):
return testRoot
root = "/mnt/sdcard"
if (not self.dirExists(root)):
root = "/data/local"
testRoot = root + "/tests"
if self.dirExists(root):
testRoot = root + "/tests"
if self.mkDir(testRoot):
return testRoot
testRoot = "/data/local/tests"
if (not self.dirExists(testRoot)):
self.mkDir(testRoot)
return testRoot
@ -675,11 +689,14 @@ class DeviceManagerADB(DeviceManager):
def runCmd(self, args):
# If we are not root but have run-as, and we're trying to execute
# a shell command then using run-as is the best we can do
finalArgs = [self.adbPath]
if self.deviceSerial:
finalArgs.extend(['-s', self.deviceSerial])
if (not self.haveRoot and self.useRunAs and args[0] == "shell" and args[1] != "run-as"):
args.insert(1, "run-as")
args.insert(2, self.packageName)
args.insert(0, self.adbPath)
return subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
finalArgs.extend(args)
return subprocess.Popen(finalArgs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def runCmdAs(self, args):
if self.useRunAs:
@ -690,11 +707,14 @@ class DeviceManagerADB(DeviceManager):
def checkCmd(self, args):
# If we are not root but have run-as, and we're trying to execute
# a shell command then using run-as is the best we can do
finalArgs = [self.adbPath]
if self.deviceSerial:
finalArgs.extend(['-s', self.deviceSerial])
if (not self.haveRoot and self.useRunAs and args[0] == "shell" and args[1] != "run-as"):
args.insert(1, "run-as")
args.insert(2, self.packageName)
args.insert(0, self.adbPath)
return subprocess.check_call(args)
finalArgs.extend(args)
return subprocess.check_call(finalArgs)
def checkCmdAs(self, args):
if (self.useRunAs):
@ -731,6 +751,23 @@ class DeviceManagerADB(DeviceManager):
raise DMError("unable to execute ADB: ensure Android SDK is installed and adb is in your $PATH")
def verifyDevice(self):
# If there is a device serial number, see if adb is connected to it
if self.deviceSerial:
deviceStatus = None
proc = subprocess.Popen([self.adbPath, "devices"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
for line in proc.stdout:
m = re.match('(.+)?\s+(.+)$', line)
if m:
if self.deviceSerial == m.group(1):
deviceStatus = m.group(2)
if deviceStatus == None:
raise DMError("device not found: %s" % self.deviceSerial)
elif deviceStatus != "device":
raise DMError("bad status for device %s: %s" % (self.deviceSerial,
deviceStatus))
# Check to see if we can connect to device and run a simple command
try:
self.checkCmd(["shell", "echo"])

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

@ -210,11 +210,7 @@ class PythonJob(Job):
if self.method not in m.__dict__:
print >>sys.stderr, "No method named '%s' in module %s" % (method, module)
return -127
try:
m.__dict__[self.method](self.argv)
except TypeError:
print >> sys.stderr, "FAILED calling %r in %r" % (self.method, m)
raise
m.__dict__[self.method](self.argv)
except PythonException, e:
print >>sys.stderr, e
return e.exitcode

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

@ -198,6 +198,44 @@ GetScriptContext(JSContext *cx)
return GetScriptContextFromJSContext(cx);
}
// Callbacks for the JS engine to use to push/pop context principals.
static JSBool
PushPrincipalCallback(JSContext *cx, JSPrincipals *principals)
{
// We should already be in the compartment of the given principal.
MOZ_ASSERT(principals ==
JS_GetCompartmentPrincipals((js::GetContextCompartment(cx))));
// Get the security manager.
nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
if (!ssm) {
return true;
}
// Push the principal.
JSStackFrame *fp = NULL;
nsresult rv = ssm->PushContextPrincipal(cx, JS_FrameIterator(cx, &fp),
nsJSPrincipals::get(principals));
if (NS_FAILED(rv)) {
JS_ReportOutOfMemory(cx);
return false;
}
return true;
}
static JSBool
PopPrincipalCallback(JSContext *cx)
{
nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
if (ssm) {
ssm->PopContextPrincipal(cx);
}
return true;
}
inline void SetPendingException(JSContext *cx, const char *aMsg)
{
JSAutoRequest ar(cx);
@ -3391,7 +3429,9 @@ nsresult nsScriptSecurityManager::Init()
CheckObjectAccess,
nsJSPrincipals::Subsume,
ObjectPrincipalFinder,
ContentSecurityPolicyPermitsJSAction
ContentSecurityPolicyPermitsJSAction,
PushPrincipalCallback,
PopPrincipalCallback
};
MOZ_ASSERT(!JS_GetSecurityCallbacks(sRuntime));

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

@ -294,13 +294,15 @@ $(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
cd $(@D); $(AUTOCONF)
CONFIG_STATUS_DEPS := \
$(wildcard $(CONFIGURES)) \
$(TOPSRCDIR)/allmakefiles.sh \
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
$(wildcard $(TOPSRCDIR)/config/milestone.txt) \
$(wildcard $(TOPSRCDIR)/js/src/config/milestone.txt) \
$(wildcard $(TOPSRCDIR)/browser/config/version.txt) \
$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
$(wildcard \
$(CONFIGURES) \
$(TOPSRCDIR)/allmakefiles.sh \
$(TOPSRCDIR)/nsprpub/configure \
$(TOPSRCDIR)/config/milestone.txt \
$(TOPSRCDIR)/js/src/config/milestone.txt \
$(TOPSRCDIR)/browser/config/version.txt \
$(TOPSRCDIR)/*/confvars.sh \
) \
$(NULL)
CONFIGURE_ENV_ARGS += \
@ -368,8 +370,7 @@ endif
####################################
# Build it
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/config $(TOPSRCDIR)/config
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status check-sync-dirs-config
$(MOZ_MAKE)
####################################
@ -427,6 +428,12 @@ cleansrcdir:
build/autoconf/clean-config.sh; \
fi;
## Sanity check $X and js/src/$X are in sync
.PHONY: check-sync-dirs
check-sync-dirs: check-sync-dirs-build check-sync-dirs-config
check-sync-dirs-%:
@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/$* $(TOPSRCDIR)/$*
echo-variable-%:
@echo $($*)

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

@ -231,6 +231,7 @@ LIBXUL_LIBS=@LIBXUL_LIBS@
ENABLE_STRIP = @ENABLE_STRIP@
PKG_SKIP_STRIP = @PKG_SKIP_STRIP@
STRIP_FLAGS = @STRIP_FLAGS@
MOZ_POST_DSO_LIB_COMMAND = @MOZ_POST_DSO_LIB_COMMAND@
MOZ_POST_PROGRAM_COMMAND = @MOZ_POST_PROGRAM_COMMAND@

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

@ -837,3 +837,8 @@ EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
endif
EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
# Include internal ply only if needed
ifndef MOZ_SYSTEM_PLY
PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
endif

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

@ -47,10 +47,15 @@ def generate(args):
desc = LibDescriptor()
for arg in args:
if isObject(arg):
desc['OBJS'].append(os.path.abspath(arg))
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
(os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
desc['LIBS'].append(os.path.abspath(arg))
if os.path.exists(arg):
desc['OBJS'].append(os.path.abspath(arg))
else:
raise Exception("File not found: %s" % arg)
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
desc['LIBS'].append(os.path.abspath(arg))
else:
raise Exception("File not found: %s" % arg)
return desc
if __name__ == '__main__':

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

@ -1444,7 +1444,7 @@ xpidl-preqs = \
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
$(REPORT_BUILD)
$(PYTHON_PATH) \
-I$(topsrcdir)/other-licenses/ply \
$(PLY_INCLUDE) \
-I$(topsrcdir)/xpcom/idl-parser \
$(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
@ -1456,7 +1456,7 @@ ifndef NO_GEN_XPT
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
$(REPORT_BUILD)
$(PYTHON_PATH) \
-I$(topsrcdir)/other-licenses/ply \
$(PLY_INCLUDE) \
-I$(topsrcdir)/xpcom/idl-parser \
-I$(topsrcdir)/xpcom/typelib/xpt/tools \
$(topsrcdir)/xpcom/idl-parser/typelib.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@

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

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

@ -145,6 +145,9 @@ class TestExpandLibsGen(TestCaseWithTmpDir):
self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']])
self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']])
self.assertRaises(Exception, generate, files + [self.tmpfile(Obj('z'))])
self.assertRaises(Exception, generate, files + [self.tmpfile(Lib('y'))])
class TestExpandInit(TestCaseWithTmpDir):
def init(self):
''' Initializes test environment for library expansion tests'''

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

@ -3380,7 +3380,7 @@ else
dnl ========================================================
dnl = Check for freetype2 and its functionality
dnl ========================================================
AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
if test "$_HAVE_FREETYPE2"; then
_SAVE_LIBS="$LIBS"
@ -8403,6 +8403,7 @@ AC_SUBST(MOZ_ANDROID_HISTORY)
AC_SUBST(MOZ_WEBSMS_BACKEND)
AC_SUBST(ENABLE_STRIP)
AC_SUBST(PKG_SKIP_STRIP)
AC_SUBST(STRIP_FLAGS)
AC_SUBST(USE_ELF_DYNSTR_GC)
AC_SUBST(USE_ELF_HACK)
AC_SUBST(INCREMENTAL_LINKER)

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

@ -800,9 +800,14 @@ public:
/**
* Set the inline style rule for this node. This will send an
* appropriate AttributeChanged notification if aNotify is true.
* appropriate AttributeChanged notification if aNotify is true. If
* a serialized form of aStyleRule is available, a pointer to it
* should be passed in aSerialized. Otherwise, aSerialized should
* be null.
*/
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, bool aNotify) = 0;
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify) = 0;
/**
* Is the attribute named stored in the mapped attributes?

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

@ -385,6 +385,12 @@ nsMutationReceiver::ContentRemoved(nsIDocument* aDocument,
Observer()->ScheduleForRun();
}
void nsMutationReceiver::NodeWillBeDestroyed(const nsINode *aNode)
{
NS_ASSERTION(!mParent, "Shouldn't have mParent here!");
Disconnect(true);
}
// Observer
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMutationObserver)

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

@ -265,34 +265,12 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsMutationReceiver)
virtual void AttributeWillChange(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
virtual void CharacterDataWillChange(nsIDocument *aDocument,
nsIContent* aContent,
CharacterDataChangeInfo* aInfo);
virtual void ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
PRInt32 aNewIndexInContainer);
virtual void ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
virtual void ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsIContent* aPreviousSibling);
virtual void NodeWillBeDestroyed(const nsINode *aNode)
{
NS_ASSERTION(!mParent, "Shouldn't have mParent here!");
Disconnect(true);
}
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsMutationReceiver, NS_MUTATION_OBSERVER_IID)

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

@ -1719,7 +1719,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsDocument,
nsNodeUtils::LastRelease(this))
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument)
return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
if (nsGenericElement::CanSkip(tmp, aRemovingAllowed)) {
nsEventListenerManager* elm = tmp->GetListenerManager(false);
if (elm) {
elm->UnmarkGrayJSListeners();
}
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDocument)

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

@ -980,6 +980,7 @@ nsGenericDOMDataNode::GetInlineStyleRule()
NS_IMETHODIMP
nsGenericDOMDataNode::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)
{
NS_NOTREACHED("How come we're setting inline style on a non-element?");

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

@ -248,7 +248,8 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, bool aNotify);
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized, bool aNotify);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;

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

@ -3609,6 +3609,7 @@ nsGenericElement::GetInlineStyleRule()
NS_IMETHODIMP
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)
{
NS_NOTYETIMPLEMENTED("nsGenericElement::SetInlineStyleRule");

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

@ -368,7 +368,9 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, bool aNotify);
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
NS_IMETHOD_(bool)
IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -1045,6 +1047,25 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
NS_GetDOMClassInfoInstance(eDOMClassInfo_##_interface##_id)); \
}
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic GetAttr and
* SetAttr methods. We use the 5-argument form of SetAttr, because
* some consumers only implement that one, hiding superclass
* 4-argument forms.
*/
#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
return GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \
{ \
return SetAttr(kNameSpaceID_None, nsGkAtoms::_atom, nsnull, aValue, true); \
}
/**
* Tearoff class to implement nsITouchEventReceiver
*/

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

@ -2037,6 +2037,7 @@ GK_ATOM(datatable, "datatable")
GK_ATOM(droppable, "droppable")
GK_ATOM(eventFromInput, "event-from-input")
GK_ATOM(InlineBlockFrame, "InlineBlockFrame")
GK_ATOM(inlinevalue, "inline")
GK_ATOM(invalid, "invalid")
GK_ATOM(item, "item")
GK_ATOM(itemset, "itemset")

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

@ -163,6 +163,7 @@ nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
NS_IMETHODIMP
nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)
{
SetMayHaveStyle();
@ -193,7 +194,7 @@ nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aSty
modification = !!mAttrsAndChildren.GetAttr(nsGkAtoms::style);
}
nsAttrValue attrValue(aStyleRule, nsnull);
nsAttrValue attrValue(aStyleRule, aSerialized);
// XXXbz do we ever end up with ADDITION here? I doubt it.
PRUint8 modType = modification ?

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

@ -74,7 +74,9 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, bool aNotify);
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);

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

@ -314,6 +314,10 @@ nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst) const
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue *value = mAttrsAndChildren.AttrAt(i);
nsAutoString valStr;
value->ToString(valStr);
if (name->Equals(nsGkAtoms::style, kNameSpaceID_None) &&
value->Type() == nsAttrValue::eCSSStyleRule) {
// We can't just set this as a string, because that will fail
@ -323,14 +327,12 @@ nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst) const
nsRefPtr<mozilla::css::StyleRule> styleRule = do_QueryObject(ruleClone);
NS_ENSURE_TRUE(styleRule, NS_ERROR_UNEXPECTED);
rv = aDst->SetInlineStyleRule(styleRule, false);
rv = aDst->SetInlineStyleRule(styleRule, &valStr, false);
NS_ENSURE_SUCCESS(rv, rv);
continue;
}
nsAutoString valStr;
value->ToString(valStr);
rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
name->GetPrefix(), valStr, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -2261,13 +2263,6 @@ nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttri
//----------------------------------------------------------------------
nsresult
nsGenericHTMLElement::GetAttrHelper(nsIAtom* aAttr, nsAString& aValue)
{
GetAttr(kNameSpaceID_None, aAttr, aValue);
return NS_OK;
}
nsresult
nsGenericHTMLElement::SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue)
{

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

@ -607,18 +607,6 @@ protected:
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
/**
* Helper method for NS_IMPL_STRING_ATTR macro.
* Gets the value of an attribute, returns empty string if
* attribute isn't set. Only works for attributes in null namespace.
*
* @param aAttr name of attribute.
* @param aDefault default-value to return if attribute isn't set.
* @param aResult result value [out]
* @result always NS_OK
*/
NS_HIDDEN_(nsresult) GetAttrHelper(nsIAtom* aAttr, nsAString& aValue);
/**
* Helper method for NS_IMPL_STRING_ATTR macro.
* Sets the value of an attribute, returns specified default value if the
@ -1006,23 +994,6 @@ PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
//----------------------------------------------------------------------
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic GetAttr and
* SetAttr methods.
*/
#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
return GetAttrHelper(nsGkAtoms::_atom, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \
{ \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
}
/**
* This macro is similar to NS_IMPL_STRING_ATTR except that the getter method
* falls back to an alternative method if the content attribute isn't set.

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

@ -243,6 +243,7 @@ NS_IMPL_URI_ATTR(nsHTMLScriptElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type)
NS_IMPL_STRING_ATTR(nsHTMLScriptElement, HtmlFor, _for)
NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Event, event)
NS_IMPL_STRING_ATTR(nsHTMLScriptElement, CrossOrigin, crossorigin)
nsresult
nsHTMLScriptElement::GetAsync(bool* aValue)

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

@ -299,6 +299,8 @@ _TEST_FILES = \
test_bug651956.html \
test_bug694503.html \
test_object_plugin_nav.html \
test_bug742030.html \
test_bug742549.html \
$(NULL)
_BROWSER_TEST_FILES = \

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

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=742030
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 742030</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742030">Mozilla Bug 742030</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 742030 **/
const str = " color: #ff0000 ";
var span = document.createElement("span");
span.setAttribute("style", str);
is(span.getAttribute("style"), str, "Should have set properly");
var span2 = span.cloneNode(false);
is(span2.getAttribute("style"), str, "Should have cloned properly");
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,40 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=742549
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 742549</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742549">Mozilla Bug 742549</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 742549 **/
var els = [ document.createElement("script"),
document.createElementNS("http://www.w3.org/2000/svg", "script") ]
for (var i = 0; i < els.length; ++i) {
reflectString({
element: els[i],
attribute: { content: "crossorigin", idl: "crossOrigin" },
otherValues: [ "anonymous", "use-credentials" ]
})
}
</script>
</pre>
</body>
</html>

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

@ -135,6 +135,7 @@
#include "nsIRequest.h"
#include "nsHtml5TreeOpExecutor.h"
#include "nsHtml5Parser.h"
#include "nsIDOMJSWindow.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -1326,9 +1327,10 @@ nsHTMLDocument::Open(const nsAString& aContentTypeOrUrl,
if (!window) {
return NS_OK;
}
nsCOMPtr<nsIDOMJSWindow> win = do_QueryInterface(window);
nsCOMPtr<nsIDOMWindow> newWindow;
nsresult rv = window->Open(aContentTypeOrUrl, aReplaceOrName, aFeatures,
getter_AddRefs(newWindow));
nsresult rv = win->OpenJS(aContentTypeOrUrl, aReplaceOrName, aFeatures,
getter_AddRefs(newWindow));
*aReturn = newWindow.forget().get();
return rv;
}
@ -3124,22 +3126,6 @@ nsHTMLDocument::ExecCommand(const nsAString & commandID,
return rv;
}
/* TODO: don't let this call do anything if the page is not done loading */
/* boolean execCommandShowHelp(in DOMString commandID); */
NS_IMETHODIMP
nsHTMLDocument::ExecCommandShowHelp(const nsAString & commandID,
bool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = false;
// if editing is not on, bail
if (!IsEditingOnAfterFlush())
return NS_ERROR_FAILURE;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean queryCommandEnabled(in DOMString commandID); */
NS_IMETHODIMP
nsHTMLDocument::QueryCommandEnabled(const nsAString & commandID,
@ -3306,20 +3292,6 @@ nsHTMLDocument::QueryCommandSupported(const nsAString & commandID,
return NS_OK;
}
/* DOMString queryCommandText(in DOMString commandID); */
NS_IMETHODIMP
nsHTMLDocument::QueryCommandText(const nsAString & commandID,
nsAString & _retval)
{
_retval.SetLength(0);
// if editing is not on, bail
if (!IsEditingOnAfterFlush())
return NS_ERROR_FAILURE;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString queryCommandValue(in DOMString commandID); */
NS_IMETHODIMP
nsHTMLDocument::QueryCommandValue(const nsAString & commandID,

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

@ -106,6 +106,8 @@ _TEST_FILES = test_bug1682.html \
test_bug571981.html \
test_bug677495.html \
test_bug677495-1.html \
test_bug742261.html \
test_bug741266.html \
$(NULL)
ifneq (mobile,$(MOZ_BUILD_APP))

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=741266
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 741266</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=741266">Mozilla Bug 741266</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 741266 **/
var w = window.open("", "", "width=100,height=100");
is(w.innerHeight, 100, "Popup height should be 100 when opened with window.open");
// XXXbz On at least some platforms, the innerWidth is off by the scrollbar
// width for some reason. So just make sure it's the same for both popups.
var width = w.innerWidth;
w.close();
w = document.open("", "", "width=100,height=100");
is(w.innerHeight, 100, "Popup height should be 100 when opened with document.open");
is(w.innerWidth, width, "Popup width should be the same when opened with document.open");
w.close();
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,14 @@
<!doctype html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=742261
-->
<title>Test for Bug 742261</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<body>
<script>
is(document.execCommandShowHelp, undefined,
"execCommandShowHelp shouldn't exist");
is(document.queryCommandText, undefined,
"queryCommandText shouldn't exist");
</script>

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

@ -177,18 +177,9 @@ nsSVGScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
// nsIDOMSVGScriptElement methods
/* attribute DOMString type; */
NS_IMETHODIMP
nsSVGScriptElement::GetType(nsAString & aType)
{
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
return NS_OK;
}
NS_IMETHODIMP
nsSVGScriptElement::SetType(const nsAString & aType)
{
return SetAttr(kNameSpaceID_None, nsGkAtoms::type, aType, true);
}
NS_IMPL_STRING_ATTR(nsSVGScriptElement, Type, type)
/* attribute DOMString crossOrigin */
NS_IMPL_STRING_ATTR(nsSVGScriptElement, CrossOrigin, crossorigin)
//----------------------------------------------------------------------
// nsIDOMSVGURIReference methods

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

@ -906,9 +906,6 @@ nsXBLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
return NS_ERROR_OUT_OF_MEMORY;
prototype->mNodeInfo = aNodeInfo;
// XXX - we need to do exactly what the XUL content-sink does (eg,
// look for 'type', 'version' etc attributes)
prototype->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
AddAttributesToXULPrototype(aAtts, aAttsCount, prototype);

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

@ -1879,7 +1879,6 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
NS_ENSURE_TRUE(prototype, NS_ERROR_OUT_OF_MEMORY);
prototype->mNodeInfo = nodeInfo;
prototype->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
nsCOMPtr<Element> result;
nsresult rv =

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

@ -400,7 +400,7 @@ nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
if (!bindingDocument->GetRootElement()) {
// FIXME: How about an error console warning?
NS_WARNING("*** XBL doc with no root element! Something went horribly wrong! ***");
NS_WARNING("XBL doc with no root element - this usually shouldn't happen");
return NS_ERROR_FAILURE;
}

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

@ -414,8 +414,6 @@ nsXULElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
nsRefPtr<nsXULElement> element;
if (mPrototype) {
element = nsXULElement::Create(mPrototype, aNodeInfo, true);
NS_ASSERTION(nsIProgrammingLanguage::JAVASCRIPT == mPrototype->mScriptTypeID,
"Didn't get the default language from proto?");
}
else {
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
@ -1093,19 +1091,12 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
// the attribute isn't set yet.
MaybeAddPopupListener(aName);
if (nsContentUtils::IsEventAttributeName(aName, EventNameType_XUL) && aValue) {
// If mPrototype->mScriptTypeID != nsIProgrammingLanguage::JAVASCRIPT, it means
// we are resolving an overlay with a different default script
// language. We can't defer compilation of those handlers as
// we will have lost the script language (storing it on each
// nsXULPrototypeAttribute is expensive!)
bool defer = mPrototype == nsnull ||
mPrototype->mScriptTypeID == nsIProgrammingLanguage::JAVASCRIPT;
if (aValue->Type() == nsAttrValue::eString) {
AddScriptEventListener(aName, aValue->GetStringValue(), defer);
AddScriptEventListener(aName, aValue->GetStringValue(), true);
} else {
nsAutoString body;
aValue->ToString(body);
AddScriptEventListener(aName, body, defer);
AddScriptEventListener(aName, body, true);
}
}
@ -2506,11 +2497,6 @@ nsXULElement::RecompileScriptEventListeners()
}
if (mPrototype) {
// If we have a prototype, the node we are binding to should
// have the same script-type - otherwise we will compile the
// event handlers incorrectly.
NS_ASSERTION(mPrototype->mScriptTypeID == nsIProgrammingLanguage::JAVASCRIPT,
"Prototype and node confused about default language?");
count = mPrototype->mNumAttributes;
for (i = 0; i < count; ++i) {
@ -2579,7 +2565,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(nsXULPrototypeNode)
PRUint32 i;
for (i = 0; i < elem->mNumAttributes; ++i) {
JSObject* handler = elem->mAttributes[i].mEventHandler;
NS_IMPL_CYCLE_COLLECTION_TRACE_CALLBACK(elem->mScriptTypeID,
NS_IMPL_CYCLE_COLLECTION_TRACE_CALLBACK(nsIProgrammingLanguage::JAVASCRIPT,
handler,
"mAttributes[i].mEventHandler")
}
@ -2622,9 +2608,6 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
// Write basic prototype data
rv = aStream->Write32(mType);
// Write script language
rv |= aStream->Write32(mScriptTypeID);
// Write Node Info
PRInt32 index = aNodeInfos->IndexOf(mNodeInfo);
NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
@ -2705,11 +2688,6 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
NS_PRECONDITION(aNodeInfos, "missing nodeinfo array");
nsresult rv;
// Read script language
PRUint32 scriptId = 0;
rv = aStream->Read32(&scriptId);
mScriptTypeID = scriptId;
// Read Node Info
PRUint32 number;
rv |= aStream->Read32(&number);

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

@ -248,8 +248,7 @@ public:
mHasIdAttribute(false),
mHasClassAttribute(false),
mHasStyleAttribute(false),
mHoldsScriptObject(false),
mScriptTypeID(nsIProgrammingLanguage::UNKNOWN)
mHoldsScriptObject(false)
{
}
@ -297,11 +296,6 @@ public:
bool mHasStyleAttribute:1;
bool mHoldsScriptObject:1;
// The language ID can not be set on a per-node basis, but is tracked
// so that the language ID from the originating root can be used
// (eg, when a node from an overlay ends up in our document, that node
// must use its original script language, not our document's default.
PRUint16 mScriptTypeID;
};
class nsXULDocument;

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

@ -181,7 +181,7 @@ XULContentSinkImpl::ContextStack::GetTopNodeScriptType(PRUint32 *aScriptType)
case nsXULPrototypeNode::eType_Element: {
nsXULPrototypeElement *parent =
reinterpret_cast<nsXULPrototypeElement*>(node.get());
*aScriptType = parent->mScriptTypeID;
*aScriptType = nsIProgrammingLanguage::JAVASCRIPT;
break;
}
case nsXULPrototypeNode::eType_Script: {
@ -786,55 +786,6 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText,
return rv;
}
nsresult
XULContentSinkImpl::SetElementScriptType(nsXULPrototypeElement* element,
const PRUnichar** aAttributes,
const PRUint32 aAttrLen)
{
// First check if the attributes specify an explicit script type.
nsresult rv = NS_OK;
PRUint32 i;
bool found = false;
for (i=0;i<aAttrLen;i++) {
const nsDependentString key(aAttributes[i*2]);
if (key.EqualsLiteral("script-type")) {
const nsDependentString value(aAttributes[i*2+1]);
if (!value.IsEmpty()) {
nsCOMPtr<nsIScriptRuntime> runtime;
rv = NS_GetScriptRuntime(value, getter_AddRefs(runtime));
if (NS_SUCCEEDED(rv))
element->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
else {
// probably just a bad language name (typo, etc)
NS_WARNING("Failed to load the node's script language!");
// Leave the default language as unknown - we don't want js
// trying to execute this stuff.
NS_ASSERTION(element->mScriptTypeID == nsIProgrammingLanguage::UNKNOWN,
"Default script type should be unknown");
}
found = true;
break;
}
}
}
// If not specified, look at the context stack and use the element
// there.
if (!found) {
if (mContextStack.Depth() == 0) {
// This is the root element - default to JS
element->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
} else {
// Ask the top-node for its script type (which has already
// had this function called for it - so no need to recurse
// until we find it)
PRUint32 scriptId = 0;
rv = mContextStack.GetTopNodeScriptType(&scriptId);
element->mScriptTypeID = scriptId;
}
}
return rv;
}
nsresult
XULContentSinkImpl::OpenRoot(const PRUnichar** aAttributes,
const PRUint32 aAttrLen,
@ -873,10 +824,6 @@ XULContentSinkImpl::OpenRoot(const PRUnichar** aAttributes,
return rv;
}
// Set the correct script-type for the element.
rv = SetElementScriptType(element, aAttributes, aAttrLen);
if (NS_FAILED(rv)) return rv;
// Push the element onto the context stack, so that child
// containers will hook up to us as their parent.
rv = mContextStack.Push(element, mState);
@ -936,10 +883,7 @@ XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes,
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) ||
aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XUL)) {
// Do scripty things now. Set a script language for the element,
// even though it is ignored (the nsPrototypeScriptElement
// has its own script-type).
element->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
// Do scripty things now
rv = OpenScript(aAttributes, aLineNumber);
NS_ENSURE_SUCCESS(rv, rv);
@ -952,10 +896,6 @@ XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes,
}
}
// Set the correct script-type for the element.
rv = SetElementScriptType(element, aAttributes, aAttrLen);
if (NS_FAILED(rv)) return rv;
// Push the element onto the context stack, so that child
// containers will hook up to us as their parent.
rv = mContextStack.Push(element, mState);

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

@ -117,10 +117,6 @@ protected:
static bool IsDataInBuffer(PRUnichar* aBuffer, PRInt32 aLength);
nsresult SetElementScriptType(nsXULPrototypeElement* element,
const PRUnichar** aAttributes,
const PRUint32 aAttrLen);
// Text management
nsresult FlushText(bool aCreateTextNode = true);
nsresult AddText(const PRUnichar* aText, PRInt32 aLength);

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

@ -1439,6 +1439,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
if (tmp->mCachedXBLPrototypeHandlers.IsInitialized()) {
tmp->mCachedXBLPrototypeHandlers.EnumerateRead(MarkXBLHandlers, nsnull);
}
nsEventListenerManager* elm = tmp->GetListenerManager(false);
if (elm) {
elm->UnmarkGrayJSListeners();
}
tmp->UnmarkGrayTimers();
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
@ -1475,6 +1480,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
cb.NoteNativeChild(timeout, &NS_CYCLE_COLLECTION_NAME(nsTimeout));
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSessionStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mApplicationCache)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocumentPrincipal)
@ -1512,6 +1518,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
tmp->mListenerManager->Disconnect();
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSessionStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mApplicationCache)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocumentPrincipal)
@ -5962,8 +5969,7 @@ nsGlobalWindow::GetFrames(nsIDOMWindow** aFrames)
return NS_OK;
}
nsGlobalWindow*
nsGlobalWindow::CallerInnerWindow()
JSObject* nsGlobalWindow::CallerGlobal()
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (!cx) {
@ -5988,6 +5994,21 @@ nsGlobalWindow::CallerInnerWindow()
if (!scope)
scope = JS_GetGlobalForScopeChain(cx);
return scope;
}
nsGlobalWindow*
nsGlobalWindow::CallerInnerWindow()
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (!cx) {
NS_ERROR("Please don't call this method from C++!");
return nsnull;
}
JSObject *scope = CallerGlobal();
JSAutoEnterCompartment ac;
if (!ac.enter(cx, scope))
return nsnull;
@ -6310,21 +6331,30 @@ nsGlobalWindow::PostMessageMoz(const jsval& aMessage,
// First, get the caller's window
nsRefPtr<nsGlobalWindow> callerInnerWin = CallerInnerWindow();
if (!callerInnerWin)
return NS_OK;
NS_ABORT_IF_FALSE(callerInnerWin->IsInnerWindow(),
"should have gotten an inner window here");
nsIPrincipal* callerPrin;
if (callerInnerWin) {
NS_ABORT_IF_FALSE(callerInnerWin->IsInnerWindow(),
"should have gotten an inner window here");
// Compute the caller's origin either from its principal or, in the case the
// principal doesn't carry a URI (e.g. the system principal), the caller's
// document. We must get this now instead of when the event is created and
// dispatched, because ultimately it is the identity of the calling window
// *now* that determines who sent the message (and not an identity which might
// have changed due to intervening navigations).
nsIPrincipal* callerPrin = callerInnerWin->GetPrincipal();
// Compute the caller's origin either from its principal or, in the case the
// principal doesn't carry a URI (e.g. the system principal), the caller's
// document. We must get this now instead of when the event is created and
// dispatched, because ultimately it is the identity of the calling window
// *now* that determines who sent the message (and not an identity which might
// have changed due to intervening navigations).
callerPrin = callerInnerWin->GetPrincipal();
}
else {
// In case the global is not a window, it can be a sandbox, and the sandbox's
// principal can be used for the security check.
JSObject *global = CallerGlobal();
NS_ASSERTION(global, "Why is there no global object?");
JSCompartment *compartment = js::GetObjectCompartment(global);
callerPrin = xpc::GetCompartmentPrincipal(compartment);
}
if (!callerPrin)
return NS_OK;
nsCOMPtr<nsIURI> callerOuterURI;
if (NS_FAILED(callerPrin->GetURI(getter_AddRefs(callerOuterURI))))
return NS_OK;
@ -6334,15 +6364,20 @@ nsGlobalWindow::PostMessageMoz(const jsval& aMessage,
// if the principal has a URI, use that to generate the origin
nsContentUtils::GetUTFOrigin(callerPrin, origin);
}
else {
else if (callerInnerWin) {
// otherwise use the URI of the document to generate origin
nsCOMPtr<nsIDocument> doc = do_QueryInterface(callerInnerWin->mDocument);
nsCOMPtr<nsIDocument> doc = do_QueryInterface(callerInnerWin->GetExtantDocument());
if (!doc)
return NS_OK;
callerOuterURI = doc->GetDocumentURI();
// if the principal has a URI, use that to generate the origin
nsContentUtils::GetUTFOrigin(callerOuterURI, origin);
}
else {
// in case of a sandbox with a system principal origin can be empty
if (!nsContentUtils::IsSystemPrincipal(callerPrin))
return NS_OK;
}
// Convert the provided origin string into a URI for comparison purposes.
// "*" indicates no specific origin is required.
@ -6358,7 +6393,7 @@ nsGlobalWindow::PostMessageMoz(const jsval& aMessage,
// Create and asynchronously dispatch a runnable which will handle actual DOM
// event creation and dispatch.
nsRefPtr<PostMessageEvent> event =
new PostMessageEvent(nsContentUtils::IsCallerChrome()
new PostMessageEvent(nsContentUtils::IsCallerChrome() || !callerInnerWin
? nsnull
: callerInnerWin->GetOuterWindowInternal(),
origin,

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

@ -575,6 +575,7 @@ protected:
nsresult FinalClose();
void FreeInnerObjects();
JSObject *CallerGlobal();
nsGlobalWindow *CallerInnerWindow();
nsresult InnerSetNewDocument(nsIDocument* aDocument);

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

@ -915,7 +915,6 @@ static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
#ifdef JS_GC_ZEAL
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
static const char js_zeal_compartment_str[] = JS_OPTIONS_DOT_STR "gczeal.compartment_gc";
#endif
static const char js_methodjit_content_str[] = JS_OPTIONS_DOT_STR "methodjit.content";
static const char js_methodjit_chrome_str[] = JS_OPTIONS_DOT_STR "methodjit.chrome";
@ -1022,9 +1021,8 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
#ifdef JS_GC_ZEAL
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
PRInt32 frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
bool compartment = Preferences::GetBool(js_zeal_compartment_str, false);
if (zeal >= 0)
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency, compartment);
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency);
#endif
return 0;

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

@ -1494,12 +1494,12 @@ def getWrapTemplateForTypeImpl(type, result, descriptorProvider,
# nullable and always have [TreatNonCallableAsNull] for now.
return """
${jsvalRef} = JS::ObjectOrNullValue(%s);
return true;""" % result
return JS_WrapValue(cx, ${jsvalPtr});""" % result
if type.tag() == IDLType.Tags.any:
return """
${jsvalRef} = %s;\n
return true;""" % result
return JS_WrapValue(cx, ${jsvalPtr});""" % result
if not type.isPrimitive():
raise TypeError("Need to learn to wrap %s" % type)

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

@ -1,6 +1,6 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# # License, v. 2.0. If a copy of the MPL was not distributed with this file,
# # You can obtain one at http://mozilla.org/MPL/2.0/.
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../..
topsrcdir = @top_srcdir@
@ -76,17 +76,19 @@ $(binding_header_files): %Binding.h: $(bindinggen_dependencies) \
$(webidl_base)/%.webidl \
$(NULL)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/other-licenses/ply -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) header $(srcdir)/Bindings.conf $*Binding \
$(webidl_base)/$*.webidl
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) header \
$(srcdir)/Bindings.conf $*Binding \
$(webidl_base)/$*.webidl
$(binding_cpp_files): %Binding.cpp: $(bindinggen_dependencies) \
$(webidl_base)/%.webidl \
$(NULL)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/other-licenses/ply -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) cpp $(srcdir)/Bindings.conf $*Binding \
$(webidl_base)/$*.webidl
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) cpp \
$(srcdir)/Bindings.conf $*Binding \
$(webidl_base)/$*.webidl
$(globalgen_targets): ParserResults.pkl
@ -108,7 +110,7 @@ $(CACHE_DIR)/.done:
ParserResults.pkl: $(globalgen_dependencies) \
$(addprefix $(webidl_base)/, $(webidl_files))
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/other-licenses/ply -I$(srcdir)/parser \
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/GlobalGen.py $(ACCESSOR_OPT) $(srcdir)/Bindings.conf $(webidl_base) \
--cachedir=$(CACHE_DIR) \
$(webidl_files)

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

@ -47,7 +47,7 @@
*/
interface nsISelection;
[scriptable, uuid(0d59c4f0-2272-4a72-8197-da6f86353ec1)]
[scriptable, uuid(3dae5807-3615-4567-913f-c3956a2aa251)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
readonly attribute DOMString URL;
@ -94,9 +94,6 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
[optional] in boolean doShowUI,
[optional] in DOMString value);
// returns true if the help is being shown for command (false if not)
boolean execCommandShowHelp(in DOMString commandID);
// returns true if the command is enabled (false otherwise)
boolean queryCommandEnabled(in DOMString commandID);
@ -109,9 +106,6 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
// returns true if the command is supported on the current range
boolean queryCommandSupported(in DOMString commandID);
//
DOMString queryCommandText(in DOMString commandID);
// returns the current value of the document or current selection for command
DOMString queryCommandValue(in DOMString commandID);

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

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(aa028093-b990-4b57-b0d4-e82d80ca85b1)]
[scriptable, uuid(2a9a1a1b-d4cf-4594-a71c-f47ebd790f0d)]
interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement
{
attribute DOMString src;
@ -62,4 +62,5 @@ interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement
attribute DOMString htmlFor;
attribute DOMString event;
attribute DOMString crossOrigin;
};

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

@ -38,7 +38,7 @@
#include "nsIDOMSVGElement.idl"
[scriptable, uuid(2a837684-cf83-4fea-af06-fd1f351f901b)]
[scriptable, uuid(5f7314ba-d7b9-457b-a299-cb57658464ee)]
interface nsIDOMSVGScriptElement
: nsIDOMSVGElement
/*
@ -55,4 +55,5 @@ interface nsIDOMSVGScriptElement
{
attribute DOMString type;
// raises DOMException on setting
attribute DOMString crossOrigin;
};

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

@ -58,6 +58,7 @@ const nsIAudioManager = Ci.nsIAudioManager;
const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
const kSmsReceivedObserverTopic = "sms-received";
const kSmsDeliveredObserverTopic = "sms-delivered";
const DOM_SMS_DELIVERY_RECEIVED = "received";
const DOM_SMS_DELIVERY_SENT = "sent";
@ -84,9 +85,8 @@ function convertRILCallState(state) {
case RIL.CALL_STATE_ALERTING:
return nsIRadioInterfaceLayer.CALL_STATE_ALERTING;
case RIL.CALL_STATE_INCOMING:
return nsIRadioInterfaceLayer.CALL_STATE_INCOMING;
case RIL.CALL_STATE_WAITING:
return nsIRadioInterfaceLayer.CALL_STATE_HELD; // XXX This may not be right...
return nsIRadioInterfaceLayer.CALL_STATE_INCOMING;
default:
throw new Error("Unknown rilCallState: " + state);
}
@ -152,6 +152,7 @@ function RadioInterfaceLayer() {
type: null,
msisdn: null,
};
this._sentSmsEnvelopes = {};
}
RadioInterfaceLayer.prototype = {
@ -258,6 +259,12 @@ RadioInterfaceLayer.prototype = {
case "sms-sent":
this.handleSmsSent(message);
return;
case "sms-delivered":
this.handleSmsDelivered(message);
return;
case "sms-send-failed":
this.handleSmsSendFailed(message);
return;
case "datacallstatechange":
this.handleDataCallState(message.datacall);
break;
@ -282,9 +289,6 @@ RadioInterfaceLayer.prototype = {
case "siminfo":
this.radioState.msisdn = message.msisdn;
break;
case "error":
debug("Received error message: " + JSON.stringify(message));
break;
default:
throw new Error("Don't know about this message type: " + message.type);
}
@ -426,20 +430,79 @@ RadioInterfaceLayer.prototype = {
Services.obs.notifyObservers(sms, kSmsReceivedObserverTopic, null);
},
/**
* Local storage for sent SMS messages.
*/
_sentSmsEnvelopes: null,
createSmsEnvelope: function createSmsEnvelope(options) {
let i;
for (i = 1; this._sentSmsEnvelopes[i]; i++) {
// Do nothing.
}
debug("createSmsEnvelope: assigned " + i);
options.envelopeId = i;
this._sentSmsEnvelopes[i] = options;
},
handleSmsSent: function handleSmsSent(message) {
debug("handleSmsSent: " + JSON.stringify(message));
let options = this._sentSmsEnvelopes[message.envelopeId];
if (!options) {
return;
}
let timestamp = Date.now();
let id = gSmsDatabaseService.saveSentMessage(message.number,
message.fullBody,
let id = gSmsDatabaseService.saveSentMessage(options.number,
options.fullBody,
timestamp);
let sms = gSmsService.createSmsMessage(id,
DOM_SMS_DELIVERY_SENT,
null,
message.number,
message.fullBody,
options.number,
options.fullBody,
timestamp);
//TODO handle errors (bug 727319)
gSmsRequestManager.notifySmsSent(message.requestId, sms);
if (!options.requestStatusReport) {
// No more used if STATUS-REPORT not requested.
delete this._sentSmsEnvelopes[message.envelopeId];
} else {
options.sms = sms;
}
gSmsRequestManager.notifySmsSent(options.requestId, sms);
},
handleSmsDelivered: function handleSmsDelivered(message) {
debug("handleSmsDelivered: " + JSON.stringify(message));
let options = this._sentSmsEnvelopes[message.envelopeId];
if (!options) {
return;
}
delete this._sentSmsEnvelopes[message.envelopeId];
Services.obs.notifyObservers(options.sms, kSmsDeliveredObserverTopic, null);
},
handleSmsSendFailed: function handleSmsSendFailed(message) {
debug("handleSmsSendFailed: " + JSON.stringify(message));
let options = this._sentSmsEnvelopes[message.envelopeId];
if (!options) {
return;
}
delete this._sentSmsEnvelopes[message.envelopeId];
let error = gSmsRequestManager.UNKNOWN_ERROR;
switch (message.error) {
case RIL.ERROR_RADIO_NOT_AVAILABLE:
error = gSmsRequestManager.NO_SIGNAL_ERROR;
break;
}
gSmsRequestManager.notifySmsSendFailed(options.requestId, error);
},
/**
@ -513,6 +576,14 @@ RadioInterfaceLayer.prototype = {
rejectCall: function rejectCall(callIndex) {
this.worker.postMessage({type: "rejectCall", callIndex: callIndex});
},
holdCall: function holdCall(callIndex) {
this.worker.postMessage({type: "holdCall", callIndex: callIndex});
},
resumeCall: function resumeCall(callIndex) {
this.worker.postMessage({type: "resumeCall", callIndex: callIndex});
},
get microphoneMuted() {
return gAudioManager.microphoneMuted;
@ -914,6 +985,7 @@ RadioInterfaceLayer.prototype = {
options.number = number;
options.requestId = requestId;
options.processId = processId;
options.requestStatusReport = true;
this._fragmentText(message, options);
if (options.segmentMaxSeq > 1) {
@ -921,6 +993,9 @@ RadioInterfaceLayer.prototype = {
options.segmentRef = this.nextSegmentRef;
}
// Keep current SMS message info for sent/delivered notifications
this.createSmsEnvelope(options);
this.worker.postMessage(options);
},

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