Merge from mozilla-central.

This commit is contained in:
Jan de Mooij 2013-02-26 17:21:42 +01:00
commit 96e32ed42e
528 changed files with 7605 additions and 2895 deletions

View File

@ -15,4 +15,4 @@
#
# Note: The description below will be part of the error message shown to users.
#
Bug 829832 - BackgroundFileSaver xpcshell failures without clobber
Bug 845063 needs clobber

View File

@ -10,37 +10,62 @@ interface nsIAccessible;
/**
* This interface gives access to an accessible's set of relations.
* Be carefull, do not change constants until ATK has a structure to map gecko
* constants into ATK constants.
*/
[scriptable, uuid(f42a1589-70ab-4704-877f-4a9162bbe188)]
[scriptable, uuid(9f85fc0d-2969-48e6-b822-68140f7e5770)]
interface nsIAccessibleRelation : nsISupports
{
const unsigned long RELATION_NUL = 0x00;
/**
* Some attribute of this object is affected by a target object.
* This object is labelled by a target object.
*/
const unsigned long RELATION_CONTROLLED_BY = 0x01;
// First relation
const unsigned long RELATION_FIRST = RELATION_CONTROLLED_BY;
/**
* This object is interactive and controls some attribute of a target object.
*/
const unsigned long RELATION_CONTROLLER_FOR = 0x02;
const unsigned long RELATION_LABELLED_BY = 0x00;
/**
* This object is label for a target object.
*/
const unsigned long RELATION_LABEL_FOR = 0x03;
const unsigned long RELATION_LABEL_FOR = 0x01;
/**
* This object is labelled by a target object.
* This object is described by the target object.
*/
const unsigned long RELATION_LABELLED_BY = 0x04;
const unsigned long RELATION_DESCRIBED_BY = 0x02;
/**
* This object is describes the target object.
*/
const unsigned long RELATION_DESCRIPTION_FOR = 0x3;
/**
* This object is a child of a target object.
*/
const unsigned long RELATION_NODE_CHILD_OF = 0x4;
/**
* This object is a parent of a target object. A dual relation to
* RELATION_NODE_CHILD_OF
*/
const unsigned long RELATION_NODE_PARENT_OF = 0x5;
/**
* Some attribute of this object is affected by a target object.
*/
const unsigned long RELATION_CONTROLLED_BY = 0x06;
/**
* This object is interactive and controls some attribute of a target object.
*/
const unsigned long RELATION_CONTROLLER_FOR = 0x07;
/**
* Content flows from this object to a target object, i.e. has content that
* flows logically to another object in a sequential way, e.g. text flow.
*/
const unsigned long RELATION_FLOWS_TO = 0x08;
/**
* Content flows to this object from a target object, i.e. has content that
* flows logically from another object in a sequential way, e.g. text flow.
*/
const unsigned long RELATION_FLOWS_FROM = 0x09;
/**
* This object is a member of a group of one or more objects. When there is
@ -48,71 +73,41 @@ interface nsIAccessibleRelation : nsISupports
* target, e.g. a grouping object. It is also possible that each member has
* multiple additional targets, e.g. one for every other member in the group.
*/
const unsigned long RELATION_MEMBER_OF = 0x05;
/**
* This object is a child of a target object.
*/
const unsigned long RELATION_NODE_CHILD_OF = 0x06;
/**
* Content flows from this object to a target object, i.e. has content that
* flows logically to another object in a sequential way, e.g. text flow.
*/
const unsigned long RELATION_FLOWS_TO = 0x07;
/**
* Content flows to this object from a target object, i.e. has content that
* flows logically from another object in a sequential way, e.g. text flow.
*/
const unsigned long RELATION_FLOWS_FROM = 0x08;
const unsigned long RELATION_MEMBER_OF = 0x0a;
/**
* This object is a sub window of a target object.
*/
const unsigned long RELATION_SUBWINDOW_OF = 0x09;
const unsigned long RELATION_SUBWINDOW_OF = 0x0b;
/**
* This object embeds a target object. This relation can be used on the
* OBJID_CLIENT accessible for a top level window to show where the content
* areas are.
*/
const unsigned long RELATION_EMBEDS = 0x0a;
const unsigned long RELATION_EMBEDS = 0x0c;
/**
* This object is embedded by a target object.
*/
const unsigned long RELATION_EMBEDDED_BY = 0x0b;
const unsigned long RELATION_EMBEDDED_BY = 0x0d;
/**
* This object is a transient component related to the target object. When
* this object is activated the target object doesn't lose focus.
*/
const unsigned long RELATION_POPUP_FOR = 0x0c;
const unsigned long RELATION_POPUP_FOR = 0x0e;
/**
* This object is a parent window of the target object.
*/
const unsigned long RELATION_PARENT_WINDOW_OF = 0x0d;
/**
* This object is described by the target object.
*/
const unsigned long RELATION_DESCRIBED_BY = 0x0e;
/**
* This object is describes the target object.
*/
const unsigned long RELATION_DESCRIPTION_FOR = 0x0f;
// Last relation that is standard to desktop accessibility APIs
const unsigned long RELATION_LAST = RELATION_DESCRIPTION_FOR;
const unsigned long RELATION_PARENT_WINDOW_OF = 0x0f;
/**
* Part of a form/dialog with a related default button. It is used for
* MSAA only, no for IA2 nor ATK.
* MSAA/XPCOM, it isn't for IA2 or ATK.
*/
const unsigned long RELATION_DEFAULT_BUTTON = 0x4000;
const unsigned long RELATION_DEFAULT_BUTTON = 0x10;
/**
* Returns the type of the relation.

View File

@ -853,21 +853,29 @@ refRelationSetCB(AtkObject *aAtkObj)
if (!accWrap)
return relation_set;
uint32_t relationTypes[] = {
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
// Keep in sync with AtkRelationType enum.
static const uint32_t relationTypes[] = {
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_MEMBER_OF,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_SUBWINDOW_OF,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_EMBEDDED_BY,
nsIAccessibleRelation::RELATION_POPUP_FOR,
nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
nsIAccessibleRelation::RELATION_NODE_PARENT_OF
};
for (uint32_t i = 0; i < ArrayLength(relationTypes); i++) {
AtkRelationType atkType = static_cast<AtkRelationType>(relationTypes[i]);
// Shift to 1 to skip ATK_RELATION_NULL.
AtkRelationType atkType = static_cast<AtkRelationType>(i + 1);
AtkRelation* atkRelation =
atk_relation_set_get_relation_by_type(relation_set, atkType);
if (atkRelation)

View File

@ -138,6 +138,55 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
mParent = parentPrevSibling;
}
Accessible*
AccGroupInfo::FirstItemOf(Accessible* aContainer)
{
// ARIA trees can be arranged by ARIA groups, otherwise aria-level works.
a11y::role containerRole = aContainer->Role();
Accessible* item = aContainer->NextSibling();
if (item) {
if (containerRole == roles::OUTLINEITEM && item->Role() == roles::GROUPING)
item = item->FirstChild();
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
return item;
}
// Otherwise it can be a direct child.
item = aContainer->FirstChild();
if (item && IsConceptualParent(BaseRole(item->Role()), containerRole))
return item;
return nullptr;
}
Accessible*
AccGroupInfo::NextItemTo(Accessible* aItem)
{
AccGroupInfo* groupInfo = aItem->GetGroupInfo();
if (!groupInfo)
return nullptr;
// If the item in middle of the group then search next item in siblings.
if (groupInfo->PosInSet() >= groupInfo->SetSize())
return nullptr;
Accessible* parent = aItem->Parent();
uint32_t childCount = parent->ChildCount();
for (int32_t idx = aItem->IndexInParent() + 1; idx < childCount; idx++) {
Accessible* nextItem = parent->GetChildAt(idx);
AccGroupInfo* nextGroupInfo = nextItem->GetGroupInfo();
if (nextGroupInfo &&
nextGroupInfo->ConceptualParent() == groupInfo->ConceptualParent()) {
return nextItem;
}
}
NS_NOTREACHED("Item in the midle of the group but there's no next item!");
return nullptr;
}
bool
AccGroupInfo::IsConceptualParent(role aRole, role aParentRole)
{

View File

@ -17,11 +17,22 @@ namespace a11y {
class AccGroupInfo
{
public:
AccGroupInfo(Accessible* aItem, mozilla::a11y::role aRole);
~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo); }
int32_t PosInSet() const { return mPosInSet; }
/**
* Return 1-based position in the group.
*/
uint32_t PosInSet() const { return mPosInSet; }
/**
* Return a number of items in the group.
*/
uint32_t SetSize() const { return mSetSize; }
/**
* Return a direct or logical parent of the accessible that this group info is
* created for.
*/
Accessible* ConceptualParent() const { return mParent; }
/**
@ -50,9 +61,23 @@ public:
return info;
}
/**
* Return a first item for the given container.
*/
static Accessible* FirstItemOf(Accessible* aContainer);
/**
* Return next item of the same group to the given item.
*/
static Accessible* NextItemTo(Accessible* aItem);
protected:
AccGroupInfo(Accessible* aItem, a11y::role aRole);
private:
AccGroupInfo(const AccGroupInfo&);
AccGroupInfo& operator =(const AccGroupInfo&);
AccGroupInfo() MOZ_DELETE;
AccGroupInfo(const AccGroupInfo&) MOZ_DELETE;
AccGroupInfo& operator =(const AccGroupInfo&) MOZ_DELETE;
static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole)
{
@ -71,8 +96,7 @@ private:
* Return true if the given parent role is conceptual parent of the given
* role.
*/
static bool IsConceptualParent(mozilla::a11y::role aRole,
mozilla::a11y::role aParentRole);
static bool IsConceptualParent(a11y::role aRole, a11y::role aParentRole);
uint32_t mPosInSet;
uint32_t mSetSize;

View File

@ -5,7 +5,11 @@
#include "AccIterator.h"
#include "nsAccessibilityService.h"
#include "AccGroupInfo.h"
#include "Accessible-inl.h"
#ifdef MOZ_XUL
#include "XULTreeAccessible.h"
#endif
#include "mozilla/dom/Element.h"
#include "nsBindingManager.h"
@ -329,6 +333,11 @@ IDRefsIterator::Next()
return nextElm ? mDoc->GetAccessible(nextElm) : nullptr;
}
////////////////////////////////////////////////////////////////////////////////
// SingleAccIterator
////////////////////////////////////////////////////////////////////////////////
Accessible*
SingleAccIterator::Next()
{
@ -337,3 +346,56 @@ SingleAccIterator::Next()
return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nullptr;
}
////////////////////////////////////////////////////////////////////////////////
// ItemIterator
////////////////////////////////////////////////////////////////////////////////
Accessible*
ItemIterator::Next()
{
if (mContainer) {
mAnchor = AccGroupInfo::FirstItemOf(mContainer);
mContainer = nullptr;
return mAnchor;
}
return mAnchor ? (mAnchor = AccGroupInfo::NextItemTo(mAnchor)) : nullptr;
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeItemIterator
////////////////////////////////////////////////////////////////////////////////
XULTreeItemIterator::XULTreeItemIterator(XULTreeAccessible* aXULTree,
nsITreeView* aTreeView,
int32_t aRowIdx) :
mXULTree(aXULTree), mTreeView(aTreeView), mRowCount(-1),
mContainerLevel(-1), mCurrRowIdx(aRowIdx + 1)
{
mTreeView->GetRowCount(&mRowCount);
if (aRowIdx != -1)
mTreeView->GetLevel(aRowIdx, &mContainerLevel);
}
Accessible*
XULTreeItemIterator::Next()
{
while (mCurrRowIdx < mRowCount) {
int32_t level = 0;
mTreeView->GetLevel(mCurrRowIdx, &level);
if (level == mContainerLevel + 1)
return mXULTree->GetTreeItemAccessible(mCurrRowIdx++);
if (level <= mContainerLevel) { // got level up
mCurrRowIdx = mRowCount;
break;
}
mCurrRowIdx++;
}
return nullptr;
}

View File

@ -266,6 +266,53 @@ private:
nsRefPtr<Accessible> mAcc;
};
/**
* Used to iterate items of the given item container.
*/
class ItemIterator : public AccIterable
{
public:
ItemIterator(Accessible* aItemContainer) :
mContainer(aItemContainer), mAnchor(nullptr) { }
virtual ~ItemIterator() { }
virtual Accessible* Next();
private:
ItemIterator() MOZ_DELETE;
ItemIterator(const ItemIterator&) MOZ_DELETE;
ItemIterator& operator = (const ItemIterator&) MOZ_DELETE;
Accessible* mContainer;
Accessible* mAnchor;
};
/**
* Used to iterate through XUL tree items of the same level.
*/
class XULTreeItemIterator : public AccIterable
{
public:
XULTreeItemIterator(XULTreeAccessible* aXULTree, nsITreeView* aTreeView,
int32_t aRowIdx);
virtual ~XULTreeItemIterator() { }
virtual Accessible* Next();
private:
XULTreeItemIterator() MOZ_DELETE;
XULTreeItemIterator(const XULTreeItemIterator&) MOZ_DELETE;
XULTreeItemIterator& operator = (const XULTreeItemIterator&) MOZ_DELETE;
XULTreeAccessible* mXULTree;
nsITreeView* mTreeView;
int32_t mRowCount;
int32_t mContainerLevel;
int32_t mCurrRowIdx;
};
} // namespace a11y
} // namespace mozilla

View File

@ -19,12 +19,11 @@ namespace a11y {
*/
struct RelationCopyHelper
{
RelationCopyHelper(mozilla::a11y::AccIterable* aFirstIter,
mozilla::a11y::AccIterable* aLastIter) :
RelationCopyHelper(AccIterable* aFirstIter, AccIterable* aLastIter) :
mFirstIter(aFirstIter), mLastIter(aLastIter) { }
mozilla::a11y::AccIterable* mFirstIter;
mozilla::a11y::AccIterable* mLastIter;
AccIterable* mFirstIter;
AccIterable* mLastIter;
};
/**
@ -39,7 +38,7 @@ public:
Relation(const RelationCopyHelper aRelation) :
mFirstIter(aRelation.mFirstIter), mLastIter(aRelation.mLastIter) { }
Relation(mozilla::a11y::AccIterable* aIter) :
Relation(AccIterable* aIter) :
mFirstIter(aIter), mLastIter(aIter) { }
Relation(Accessible* aAcc) :
@ -69,7 +68,7 @@ public:
return RelationCopyHelper(mFirstIter.forget(), mLastIter);
}
inline void AppendIter(mozilla::a11y::AccIterable* aIter)
inline void AppendIter(AccIterable* aIter)
{
if (mLastIter)
mLastIter->mNextIter = aIter;
@ -85,7 +84,7 @@ public:
inline void AppendTarget(Accessible* aAcc)
{
if (aAcc)
AppendIter(new mozilla::a11y::SingleAccIterator(aAcc));
AppendIter(new SingleAccIterator(aAcc));
}
/**
@ -118,8 +117,8 @@ public:
private:
Relation& operator = (const Relation&);
nsAutoPtr<mozilla::a11y::AccIterable> mFirstIter;
mozilla::a11y::AccIterable* mLastIter;
nsAutoPtr<AccIterable> mFirstIter;
AccIterable* mLastIter;
};
} // namespace a11y

View File

@ -587,9 +587,8 @@ enum Role {
TOGGLE_BUTTON = 93,
/**
* Representas a control that is capable of expanding and collapsing rows as
* Represent a control that is capable of expanding and collapsing rows as
* well as showing multiple columns of data.
* XXX: it looks like this role is dupe of OUTLINE.
*/
TREE_TABLE = 94,

View File

@ -318,22 +318,22 @@ static const char kEventTypeNames[][40] = {
* nsIAccessibleRetrieval::getStringRelationType() method.
*/
static const char kRelationTypeNames[][20] = {
"unknown", // RELATION_NUL
"labelled by", // RELATION_LABELLED_BY
"label for", // RELATION_LABEL_FOR
"described by", // RELATION_DESCRIBED_BY
"description for", // RELATION_DESCRIPTION_FOR
"node child of", // RELATION_NODE_CHILD_OF
"node parent of", // RELATION_NODE_PARENT_OF
"controlled by", // RELATION_CONTROLLED_BY
"controller for", // RELATION_CONTROLLER_FOR
"label for", // RELATION_LABEL_FOR
"labelled by", // RELATION_LABELLED_BY
"member of", // RELATION_MEMBER_OF
"node child of", // RELATION_NODE_CHILD_OF
"flows to", // RELATION_FLOWS_TO
"flows from", // RELATION_FLOWS_FROM
"member of", // RELATION_MEMBER_OF
"subwindow of", // RELATION_SUBWINDOW_OF
"embeds", // RELATION_EMBEDS
"embedded by", // RELATION_EMBEDDED_BY
"popup for", // RELATION_POPUP_FOR
"parent window of", // RELATION_PARENT_WINDOW_OF
"described by", // RELATION_DESCRIBED_BY
"description for", // RELATION_DESCRIPTION_FOR
"default button" // RELATION_DEFAULT_BUTTON
};

View File

@ -1967,16 +1967,6 @@ Accessible::RelationByType(uint32_t aType)
// Relationships are defined on the same content node that the role would be
// defined on.
switch (aType) {
case nsIAccessibleRelation::RELATION_LABEL_FOR: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_labelledby));
if (mContent->Tag() == nsGkAtoms::label)
rel.AppendIter(new IDRefsIterator(mDoc, mContent, mContent->IsHTML() ?
nsGkAtoms::_for :
nsGkAtoms::control));
return rel;
}
case nsIAccessibleRelation::RELATION_LABELLED_BY: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_labelledby));
@ -1988,6 +1978,18 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_LABEL_FOR: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_labelledby));
if (mContent->Tag() == nsGkAtoms::label)
rel.AppendIter(new IDRefsIterator(mDoc, mContent, mContent->IsHTML() ?
nsGkAtoms::_for :
nsGkAtoms::control));
return rel;
}
case nsIAccessibleRelation::RELATION_DESCRIBED_BY: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_describedby));
@ -1996,6 +1998,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_describedby));
@ -2010,19 +2013,16 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_owns));
// This is an ARIA tree or treegrid that doesn't use owns, so we need to
// get the parent the hard way.
if (mRoleMapEntry && (mRoleMapEntry->role == roles::OUTLINEITEM ||
mRoleMapEntry->role == roles::ROW)) {
AccGroupInfo* groupInfo = GetGroupInfo();
if (!groupInfo)
return rel;
rel.AppendTarget(groupInfo->ConceptualParent());
rel.AppendTarget(GetGroupInfo()->ConceptualParent());
}
// If accessible is in its own Window, or is the root of a document,
@ -2043,21 +2043,52 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: {
Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_owns));
// ARIA tree or treegrid can do the hierarchy by @aria-level, ARIA trees
// also can be organized by groups.
if (mRoleMapEntry &&
(mRoleMapEntry->role == roles::OUTLINEITEM ||
mRoleMapEntry->role == roles::ROW ||
mRoleMapEntry->role == roles::OUTLINE ||
mRoleMapEntry->role == roles::TREE_TABLE)) {
rel.AppendIter(new ItemIterator(this));
}
return rel;
}
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
return Relation(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_controls));
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_controls));
rel.AppendIter(new HTMLOutputIterator(Document(), mContent));
return rel;
}
case nsIAccessibleRelation::RELATION_FLOWS_TO:
return Relation(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_flowto));
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
return Relation(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_flowto));
case nsIAccessibleRelation::RELATION_MEMBER_OF:
return Relation(mDoc, GetAtomicRegion());
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
case nsIAccessibleRelation::RELATION_EMBEDS:
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
case nsIAccessibleRelation::RELATION_POPUP_FOR:
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
return Relation();
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON: {
if (mContent->IsHTML()) {
// HTML form controls implements nsIFormControl interface.
@ -2105,15 +2136,9 @@ Accessible::RelationByType(uint32_t aType)
}
return Relation();
}
case nsIAccessibleRelation::RELATION_MEMBER_OF:
return Relation(mDoc, GetAtomicRegion());
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
case nsIAccessibleRelation::RELATION_EMBEDS:
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
case nsIAccessibleRelation::RELATION_POPUP_FOR:
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
default:
return Relation();
return Relation();
}
}
@ -2129,12 +2154,29 @@ Accessible::GetRelations(nsIArray **aRelations)
nsCOMPtr<nsIMutableArray> relations = do_CreateInstance(NS_ARRAY_CONTRACTID);
NS_ENSURE_TRUE(relations, NS_ERROR_OUT_OF_MEMORY);
for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST;
relType < nsIAccessibleRelation::RELATION_LAST;
++relType) {
static const uint32_t relationTypes[] = {
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
nsIAccessibleRelation::RELATION_NODE_PARENT_OF,
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_MEMBER_OF,
nsIAccessibleRelation::RELATION_SUBWINDOW_OF,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_EMBEDDED_BY,
nsIAccessibleRelation::RELATION_POPUP_FOR,
nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF,
nsIAccessibleRelation::RELATION_DEFAULT_BUTTON
};
for (uint32_t idx = 0; idx < ArrayLength(relationTypes); idx++) {
nsCOMPtr<nsIAccessibleRelation> relation;
nsresult rv = GetRelationByType(relType, getter_AddRefs(relation));
nsresult rv = GetRelationByType(relationTypes[idx], getter_AddRefs(relation));
if (NS_SUCCEEDED(rv) && relation) {
uint32_t targets = 0;

View File

@ -13,7 +13,6 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleEvent.h"
#include "nsIAccessibleRelation.h"
#include "nsWinUtils.h"
#include "ServiceProvider.h"
#include "Relation.h"
@ -1048,9 +1047,8 @@ AccessibleWrap::get_nRelations(long *aNRelations)
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST;
relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
Relation rel = RelationByType(relType);
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) {
Relation rel = RelationByType(sRelationTypesForIA2[idx]);
if (rel.Next())
(*aNRelations)++;
}
@ -1074,8 +1072,8 @@ AccessibleWrap::get_relation(long aRelationIndex,
return CO_E_OBJNOTCONNECTED;
long relIdx = 0;
for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST;
relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) {
uint32_t relType = sRelationTypesForIA2[idx];
Relation rel = RelationByType(relType);
nsRefPtr<ia2AccessibleRelation> ia2Relation =
new ia2AccessibleRelation(relType, &rel);
@ -1109,9 +1107,9 @@ AccessibleWrap::get_relations(long aMaxRelations,
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST;
relType <= nsIAccessibleRelation::RELATION_LAST &&
*aNRelations < aMaxRelations; relType++) {
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2) &&
*aNRelations < aMaxRelations; idx++) {
uint32_t relType = sRelationTypesForIA2[idx];
Relation rel = RelationByType(relType);
nsRefPtr<ia2AccessibleRelation> ia2Rel =
new ia2AccessibleRelation(relType, &rel);

View File

@ -9,6 +9,7 @@
#define _NS_ACCESSIBLE_RELATION_WRAP_H
#include "Accessible.h"
#include "nsIAccessibleRelation.h"
#include "nsTArray.h"
@ -60,6 +61,28 @@ private:
ULONG mReferences;
};
/**
* Relations exposed to IAccessible2.
*/
static const uint32_t sRelationTypesForIA2[] = {
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_MEMBER_OF,
nsIAccessibleRelation::RELATION_SUBWINDOW_OF,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_EMBEDDED_BY,
nsIAccessibleRelation::RELATION_POPUP_FOR,
nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF
};
} // namespace a11y
} // namespace mozilla

View File

@ -437,6 +437,19 @@ XULTreeAccessible::ChildCount() const
return childCount;
}
Relation
XULTreeAccessible::RelationByType(uint32_t aType)
{
if (aType == nsIAccessibleRelation::RELATION_NODE_PARENT_OF) {
if (mTreeView)
return Relation(new XULTreeItemIterator(this, mTreeView, -1));
return Relation();
}
return Accessible::RelationByType(aType);
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeAccessible: Widgets
@ -798,18 +811,34 @@ XULTreeItemAccessibleBase::RelationByType(uint32_t aType)
if (!mTreeView)
return Relation();
if (aType != nsIAccessibleRelation::RELATION_NODE_CHILD_OF)
return Relation();
switch (aType) {
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
int32_t parentIndex = -1;
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
return Relation();
int32_t parentIndex = -1;
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
return Relation();
if (parentIndex == -1)
return Relation(mParent);
if (parentIndex == -1)
return Relation(mParent);
XULTreeAccessible* treeAcc = mParent->AsXULTree();
return Relation(treeAcc->GetTreeItemAccessible(parentIndex));
}
XULTreeAccessible* treeAcc = mParent->AsXULTree();
return Relation(treeAcc->GetTreeItemAccessible(parentIndex));
case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: {
bool isTrue = false;
if (NS_FAILED(mTreeView->IsContainerEmpty(mRow, &isTrue)) || isTrue)
return Relation();
if (NS_FAILED(mTreeView->IsContainerOpen(mRow, &isTrue)) || !isTrue)
return Relation();
XULTreeAccessible* tree = mParent->AsXULTree();
return Relation(new XULTreeItemIterator(tree, mTreeView, mRow));
}
default:
return Relation();
}
}
uint8_t

View File

@ -47,6 +47,7 @@ public:
virtual Accessible* GetChildAt(uint32_t aIndex);
virtual uint32_t ChildCount() const;
virtual Relation RelationByType(uint32_t aType);
// SelectAccessible
virtual already_AddRefed<nsIArray> SelectedItems();

View File

@ -21,6 +21,12 @@
<script type="application/javascript">
<![CDATA[
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 1);
} else {
SimpleTest.expectAssertions(1);
}
function doTest()
{
var actionsArray = [

View File

@ -17,6 +17,14 @@
src="../actions.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Win") == 0) {
SimpleTest.expectAssertions(13);
} else if (navigator.platform.indexOf("Linux") == 0) {
SimpleTest.expectAssertions(18);
} else if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 14);
}
function getAnchorTargetDocumentAcc()
{
var thisTabDocAcc = getTabDocAccessible();

View File

@ -19,6 +19,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
src="../attributes.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Linux") == 0) {
SimpleTest.expectAssertions(0, 1);
}
function doTest()
{
// aria

View File

@ -610,6 +610,17 @@ function getTextFromClipboard()
*/
function prettyName(aIdentifier)
{
if (aIdentifier instanceof Array) {
var msg = "";
for (var idx = 0; idx < aIdentifier.length; idx++) {
if (msg != "")
msg += ", ";
msg += prettyName(aIdentifier[idx]);
}
return msg;
}
if (aIdentifier instanceof nsIAccessible) {
var acc = getAccessible(aIdentifier);
var msg = "[" + getNodePrettyName(acc.DOMNode);

View File

@ -19,6 +19,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
src="editabletext.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 3);
} else {
SimpleTest.expectAssertions(3);
}
function addTestEditable(aID, aTestRun, aTrailChar)
{
var et = new editableTextTest(aID);

View File

@ -32,6 +32,9 @@
<script type="application/javascript">
<![CDATA[
if (navigator.platform.indexOf("Mac") != 0) {
SimpleTest.expectAssertions(2);
}
////////////////////////////////////////////////////////////////////////////
// Hacky stuffs

View File

@ -24,6 +24,9 @@
<script type="application/javascript">
<![CDATA[
if (navigator.platform.indexOf("Linux") == 0) {
SimpleTest.expectAssertions(1);
}
////////////////////////////////////////////////////////////////////////////
// Helpers

View File

@ -21,6 +21,14 @@
src="../states.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Win") == 0) {
SimpleTest.expectAssertions(1, 2);
} else if (navigator.platform.indexOf("Linux") == 0) {
SimpleTest.expectAssertions(1);
} else if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 1);
}
var gQueue = null;
//var gA11yEventDumpID = "eventdump";

View File

@ -14,6 +14,7 @@ const RELATION_LABEL_FOR = nsIAccessibleRelation.RELATION_LABEL_FOR;
const RELATION_LABELLED_BY = nsIAccessibleRelation.RELATION_LABELLED_BY;
const RELATION_MEMBER_OF = nsIAccessibleRelation.RELATION_MEMBER_OF;
const RELATION_NODE_CHILD_OF = nsIAccessibleRelation.RELATION_NODE_CHILD_OF;
const RELATION_NODE_PARENT_OF = nsIAccessibleRelation.RELATION_NODE_PARENT_OF;
const RELATION_PARENT_WINDOW_OF = nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF;
const RELATION_POPUP_FOR = nsIAccessibleRelation.RELATION_POPUP_FOR;
const RELATION_SUBWINDOW_OF = nsIAccessibleRelation.RELATION_SUBWINDOW_OF;

View File

@ -71,7 +71,8 @@
testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
testRelation("treeitem6", RELATION_NODE_CHILD_OF, "treeitem5");
testRelation("treeitem6", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem7", RELATION_NODE_CHILD_OF, "treeitem6");
// 'node child of' relation for row role of treegrid
testRelation("treegridrow1", RELATION_NODE_CHILD_OF, "treegrid");
@ -86,6 +87,19 @@
var iframeDocAcc = getAccessible(iframeDoc);
testRelation(iframeDocAcc, RELATION_NODE_CHILD_OF, iframeAcc);
// 'node parent of' relation on ARIA tree and treegrid.
testRelation("tree", RELATION_NODE_PARENT_OF,
["treeitem1", "treeitem2", // aria-owns
"treeitem3", "treeitem4", "treeitem6"]); // children
testRelation("treeitem4", RELATION_NODE_PARENT_OF,
"treeitem5"); // aria-level
testRelation("treeitem6", RELATION_NODE_PARENT_OF,
"treeitem7"); // // group role
testRelation("treegridrow2", RELATION_NODE_PARENT_OF, "treegridrow3");
testRelation("treegrid", RELATION_NODE_PARENT_OF,
["treegridrow1", "treegridrow2"]);
// aria-controls
getAccessible("tab");
todo(false,
@ -141,22 +155,27 @@
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=475298"
title="mochitests for accessible relations">
Mozilla Bug 475298
Bug 475298
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=527461"
title="Implement RELATION_NODE_PARENT_OF">
Bug 527461
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
title="make HTML <output> accessible">
Mozilla Bug 558036
Bug 558036
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=682790"
title="Ignore implicit label association when it's associated explicitly">
Mozilla Bug 682790
Bug 682790
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=687393"
title="HTML select options gets relation from containing label">
Mozilla Bug 687393
Bug 687393
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -227,8 +246,9 @@
<div role="treeitem" id="treeitem3">Blue</div>
<div role="treeitem" id="treeitem4" aria-level="1">Green</div>
<div role="treeitem" id="treeitem5" aria-level="2">Light green</div>
<div role="treeitem" id="treeitem6" aria-level="1">Green2</div>
<div role="group">
<div role="treeitem" id="treeitem6">Super light green</div>
<div role="treeitem" id="treeitem7">Super light green</div>
</div>
</div>

View File

@ -47,6 +47,11 @@
var treeitem6 = treeitem5.nextSibling;
testRelation(treeitem6, RELATION_NODE_CHILD_OF, [tree]);
testRelation(tree, RELATION_NODE_PARENT_OF,
[treeitem1, treeitem2, treeitem5, treeitem6]);
testRelation(treeitem2, RELATION_NODE_PARENT_OF,
[treeitem3, treeitem4]);
// treeitems and treecells shouldn't pick up relations from tree
testRelation(treeitem1, RELATION_LABELLED_BY, null);
testRelation(treeitem1.firstChild, RELATION_LABELLED_BY, null);
@ -64,12 +69,17 @@
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
Bug 503727
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=527461"
title="Implement RELATION_NODE_PARENT_OF">
Bug 527461
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=691248"
title="XUL tree items shouldn't pick up relations from XUL tree">
Mozilla Bug 691248
Bug 691248
</a>
<p id="display"></p>
<div id="content" style="display: none">

View File

@ -22,6 +22,12 @@
src="../browser.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 1);
} else {
SimpleTest.expectAssertions(1);
}
function hasTabModalPrompts() {
try {
return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");

View File

@ -11,7 +11,12 @@
<script type="application/javascript"
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 23);
} else {
SimpleTest.expectAssertions(23);
}
function doTest()
{
// __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__

View File

@ -13,7 +13,12 @@
<script type="application/javascript"
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 10);
} else {
SimpleTest.expectAssertions(10);
}
function doTest()
{
// __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n

View File

@ -12,7 +12,12 @@
<script type="application/javascript"
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 1);
} else {
SimpleTest.expectAssertions(1);
}
function doTest()
{
// "one two"

View File

@ -16,6 +16,10 @@
src="../states.js"></script>
<script type="application/javascript">
if (navigator.platform.indexOf("Win") == 0) {
SimpleTest.expectAssertions(0, 1);
}
function doTest()
{
var tree =

View File

@ -18,6 +18,11 @@
<script type="application/javascript">
<![CDATA[
if (navigator.platform.indexOf("Mac") == 0) {
SimpleTest.expectAssertions(0, 1);
} else {
SimpleTest.expectAssertions(1);
}
////////////////////////////////////////////////////////////////////////////
// Test

View File

@ -635,6 +635,8 @@ pref("memory.free_dirty_pages", true);
pref("wap.UAProf.url", "");
pref("wap.UAProf.tagname", "x-wap-profile");
pref("layout.imagevisibility.enabled", false);
// Enable native identity (persona/browserid)
pref("dom.identity.enabled", true);
@ -655,3 +657,5 @@ pref("memory_info_dumper.watch_fifo.directory", "/data/local");
pref("dom.disable_input_file", true);
pref("general.useragent.enable_overrides", true);
pref("b2g.version", @MOZ_B2G_VERSION@);

View File

@ -155,6 +155,11 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
});
});
SettingsListener.observe('ril.mms.retrieval_mode', 'manual',
function(value) {
Services.prefs.setCharPref('dom.mms.retrieval_mode', value);
});
SettingsListener.observe('ril.sms.strict7BitEncoding.enabled', false,
function(value) {
Services.prefs.setBoolPref('dom.sms.strict7BitEncoding', value);

View File

@ -48,6 +48,7 @@ DirectoryProvider.prototype = {
classID: Components.ID("{9181eb7c-6f87-11e1-90b1-4f59d80dd2e5}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(DirectoryProvider),
getFile: function dp_getFile(prop, persistent) {
#ifdef MOZ_WIDGET_GONK
@ -105,6 +106,7 @@ DirectoryProvider.prototype = {
if (!Services.volumeService) {
return this.createUpdatesDir(LOCAL_DIR, subdir);
}
let activeUpdate = Services.um.activeUpdate;
if (gUseSDCard) {
if (this.volumeHasFreeSpace(gExtStorage, requiredSpace)) {
@ -158,7 +160,8 @@ DirectoryProvider.prototype = {
// error and let upstream code handle it more gracefully.
log("Error: No volume found with " + requiredSpace + " bytes for downloading"+
" update " + activeUpdate.name);
throw Cr.NS_ERROR_FILE_TOO_BIG;
activeUpdate.errorCode = Cr.NS_ERROR_FILE_TOO_BIG;
return null;
},
createUpdatesDir: function dp_createUpdatesDir(root, subdir) {

View File

@ -25,7 +25,6 @@ const PREF_DOWNLOAD_WATCHDOG_TIMEOUT = "b2g.update.download-watchdog-timeout
const PREF_DOWNLOAD_WATCHDOG_MAX_RETRIES = "b2g.update.download-watchdog-max-retries";
const NETWORK_ERROR_OFFLINE = 111;
const FILE_ERROR_TOO_BIG = 112;
const HTTP_ERROR_OFFSET = 1000;
const STATE_DOWNLOADING = 'downloading';
@ -314,7 +313,8 @@ UpdatePrompt.prototype = {
}
log("Error downloading update " + aUpdate.name + ": " + aUpdate.errorCode);
if (aUpdate.errorCode == FILE_ERROR_TOO_BIG) {
let errorCode = aUpdate.errorCode >>> 0;
if (errorCode == Cr.NS_ERROR_FILE_TOO_BIG) {
aUpdate.statusText = "file-too-big";
}
this.showUpdateError(aUpdate);

View File

@ -363,8 +363,6 @@
@BINPATH@/components/nsSetDefaultBrowser.manifest
@BINPATH@/components/nsSetDefaultBrowser.js
@BINPATH@/components/BrowserPlaces.manifest
@BINPATH@/components/nsPrivateBrowsingService.manifest
@BINPATH@/components/nsPrivateBrowsingService.js
@BINPATH@/components/toolkitsearch.manifest
@BINPATH@/components/nsTryToClose.manifest
@BINPATH@/components/nsTryToClose.js

View File

@ -88,12 +88,10 @@ var FullScreen = {
handleEvent: function (event) {
switch (event.type) {
case "deactivate":
// We must call exitDomFullScreen asynchronously, since "deactivate" is
// dispatched in the middle of the focus manager's window lowering code,
// and the focus manager gets confused if we exit fullscreen mode in the
// middle of window lowering. See bug 729872.
setTimeout(this.exitDomFullScreen.bind(this), 0);
case "activate":
if (document.mozFullScreen) {
this.showWarning(this.fullscreenDoc);
}
break;
case "transitionend":
if (event.propertyName == "opacity")
@ -138,10 +136,11 @@ var FullScreen = {
gBrowser.tabContainer.addEventListener("TabClose", this.exitDomFullScreen);
gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
// Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
if (!this.useLionFullScreen &&
gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
window.addEventListener("deactivate", this);
// Add listener to detect when the fullscreen window is re-focused.
// If a fullscreen window loses focus, we show a warning when the
// fullscreen window is refocused.
if (!this.useLionFullScreen) {
window.addEventListener("activate", this);
}
// Cancel any "hide the toolbar" animation which is in progress, and make
@ -171,7 +170,8 @@ var FullScreen = {
gBrowser.tabContainer.removeEventListener("TabClose", this.exitDomFullScreen);
gBrowser.tabContainer.removeEventListener("TabSelect", this.exitDomFullScreen);
if (!this.useLionFullScreen)
window.removeEventListener("deactivate", this);
window.removeEventListener("activate", this);
this.fullscreenDoc = null;
}
},
@ -307,7 +307,6 @@ var FullScreen = {
cancelWarning: function(event) {
if (!this.warningBox)
return;
this.fullscreenDoc = null;
this.warningBox.removeEventListener("transitionend", this);
if (this.warningFadeOutTimeout) {
clearTimeout(this.warningFadeOutTimeout);

View File

@ -31,7 +31,20 @@ let SocialUI = {
SocialChatBar.update();
});
Social.init(this._providerReady.bind(this));
SocialChatBar.init();
SocialShareButton.init();
SocialMenu.init();
SocialToolbar.init();
SocialSidebar.init();
Social.init();
// If social was previously initialized it isn't going to notify observers
// about the provider being set or the list of providers changing, so
// handle those now.
if (Social.provider) {
this.observe(null, "social:provider-set", Social.provider.origin);
this.observe(null, "social:providers-changed", null);
}
},
// Called on window unload
@ -48,18 +61,6 @@ let SocialUI = {
Services.prefs.removeObserver("social.toast-notifications.enabled", this);
},
// Called once, after window load, once Social.jsm's provider has been set.
_providerReady: function SocialUI_providerReady() {
this._updateActiveUI();
this._updateMenuItems();
SocialChatBar.update();
SocialShareButton.init();
SocialMenu.populate();
SocialToolbar.init();
SocialSidebar.init();
},
// Social.provider has changed, update any state that depends on it.
// Note: this method is not called when Social.provider is first set, during
// the first window load.
@ -335,6 +336,8 @@ let SocialUI = {
}
let SocialChatBar = {
init: function() {
},
get chatbar() {
return document.getElementById("pinnedchats");
},
@ -556,7 +559,6 @@ let SocialFlyout = {
let SocialShareButton = {
// Called once, after window load, when the Social.provider object is initialized
init: function SSB_init() {
this.updateProvider();
},
// Called when the Social.provider changes
@ -703,6 +705,9 @@ let SocialShareButton = {
};
var SocialMenu = {
init: function SocialMenu_init() {
},
populate: function SocialMenu_populate() {
let submenu = document.getElementById("menu_social-statusarea-popup");
let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem");
@ -740,8 +745,6 @@ var SocialToolbar = {
let accesskey = gNavigatorBundle.getString("social.removeProvider.accesskey");
let removeCommand = document.getElementById("Social:Remove");
removeCommand.setAttribute("accesskey", accesskey);
this.updateProvider();
this._dynamicResizer = new DynamicResizeWatcher();
},
@ -1073,7 +1076,6 @@ var SocialSidebar = {
Social.setErrorListener(sbrowser, this.setSidebarErrorMessage.bind(this));
// setting isAppTab causes clicks on untargeted links to open new tabs
sbrowser.docShell.isAppTab = true;
this.update();
},
// Whether the sidebar can be shown for this window.

View File

@ -397,6 +397,14 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
opacity: 0.0;
}
/* When the modal fullscreen approval UI is showing, don't allow interaction
with the page, but when we're just showing the warning upon entering
fullscreen on an already approved page, do allow interaction with the page.
*/
#full-screen-warning-container:not([obscure-browser]) {
pointer-events: none;
}
#full-screen-warning-message {
/* We must specify a max-width, otherwise word-wrap:break-word doesn't
work in descendant <description> and <label> elements. Bug 630864. */

View File

@ -18,7 +18,7 @@
<script class="testbody" type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
const Ci = Components.interfaces;
const Ci = SpecialPowers.Ci;
let wrapperClickCount = 0;
function test1() {

View File

@ -953,7 +953,7 @@ function startTest() {
return;
}
subwindow.allowfullscreen = true;
subwindow.allowFullscreen = true;
lastElement = null;
text = subwindow.document.getElementById("test-text");

View File

@ -69,4 +69,11 @@ BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING
ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
VISUALMANIFEST := VisualElementsManifest.xml
VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
VISUALMANIFEST_PATH := $(DIST)/bin
PP_TARGETS += VISUALMANIFEST
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,16 @@
<Application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisualElements
DisplayName="@MOZ_APP_DISPLAYNAME@"
Logo="tileresources\VisualElements_logo.png"
SmallLogo="tileresources\VisualElements_smalllogo.png"
ForegroundText="light"
BackgroundColor="#1c112e">
<DefaultTile
ShortName="@MOZ_APP_DISPLAYNAME@"
ShowName="allLogos"
/>
<SplashScreen
Image="tileresources\VisualElements_splashscreen.png" />
</VisualElements>
</Application>

View File

@ -69,4 +69,11 @@ BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING
ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
VISUALMANIFEST := VisualElementsManifest.xml
VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
VISUALMANIFEST_PATH := $(DIST)/bin
PP_TARGETS += VISUALMANIFEST
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,16 @@
<Application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisualElements
DisplayName="@MOZ_APP_DISPLAYNAME@"
Logo="tileresources\VisualElements_logo.png"
SmallLogo="tileresources\VisualElements_smalllogo.png"
ForegroundText="light"
BackgroundColor="#001226">
<DefaultTile
ShortName="@MOZ_APP_DISPLAYNAME@"
ShowName="allLogos"
/>
<SplashScreen
Image="tileresources\VisualElements_splashscreen.png" />
</VisualElements>
</Application>

View File

@ -69,4 +69,11 @@ BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING
ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
VISUALMANIFEST := VisualElementsManifest.xml
VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
VISUALMANIFEST_PATH := $(DIST)/bin
PP_TARGETS += VISUALMANIFEST
endif
include $(topsrcdir)/config/rules.mk

View File

@ -69,4 +69,11 @@ BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING
ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
VISUALMANIFEST := VisualElementsManifest.xml
VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
VISUALMANIFEST_PATH := $(DIST)/bin
PP_TARGETS += VISUALMANIFEST
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,16 @@
<Application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisualElements
DisplayName="@MOZ_APP_DISPLAYNAME@"
Logo="tileresources\VisualElements_logo.png"
SmallLogo="tileresources\VisualElements_smalllogo.png"
ForegroundText="light"
BackgroundColor="#001226">
<DefaultTile
ShortName="@MOZ_APP_DISPLAYNAME@"
ShowName="allLogos"
/>
<SplashScreen
Image="tileresources\VisualElements_splashscreen.png" />
</VisualElements>
</Application>

View File

@ -11,8 +11,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = privatebrowsing
DIRS = src
TEST_DIRS += test
include $(topsrcdir)/config/rules.mk

View File

@ -1,23 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = privatebrowsing
LIBRARY_NAME = privatebrowsing_s
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
EXTRA_COMPONENTS = \
nsPrivateBrowsingServiceObsolete.manifest \
nsPrivateBrowsingServiceObsolete.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,21 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Ci = Components.interfaces;
// This dummy object just emulates the old nsIPrivateBrowsingService, and is
// non-functional in every aspect. It is only used to make Jetpack work
// again.
function PrivateBrowsingService() {
}
PrivateBrowsingService.prototype = {
classID: Components.ID("{ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrivateBrowsingService])
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingService]);

View File

@ -1,15 +0,0 @@
# WebappRT doesn't need these instructions, and they don't necessarily work
# with it, but it does use a GRE directory that the GRE shares with Firefox,
# so in order to prevent the instructions from being processed for WebappRT,
# we need to restrict them to the applications that depend on them, i.e.:
#
# b2g: {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
component {ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9} nsPrivateBrowsingServiceObsolete.js
contract @mozilla.org/privatebrowsing;1 {ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9}

View File

@ -8,6 +8,7 @@
var gClient = null;
var gTab = null;
var gHomeTab = null;
var gThreadClient = null;
var gNewGlobal = false;
var gAttached = false;
@ -33,8 +34,7 @@ function test()
gAttached = true;
// Ensure that a new global will be created.
let frame = content.document.createElement("iframe");
content.document.querySelector("body").appendChild(frame);
gHomeTab = gBrowser.addTab("about:home");
finish_test();
});
@ -58,6 +58,7 @@ function finish_test()
}
gClient.removeListener("newScript", onNewScript);
gThreadClient.resume(function(aResponse) {
removeTab(gHomeTab);
removeTab(gTab);
gClient.close(function() {
ok(gNewGlobal, "Received newGlobal event.");

View File

@ -349,8 +349,6 @@
@BINPATH@/browser/components/DownloadsUI.js
@BINPATH@/browser/components/BrowserPlaces.manifest
@BINPATH@/components/BrowserPageThumbs.manifest
@BINPATH@/browser/components/nsPrivateBrowsingServiceObsolete.manifest
@BINPATH@/browser/components/nsPrivateBrowsingServiceObsolete.js
@BINPATH@/components/SiteSpecificUserAgent.js
@BINPATH@/components/SiteSpecificUserAgent.manifest
@BINPATH@/components/toolkitsearch.manifest

View File

@ -27,7 +27,6 @@ browser/components/places/Makefile
browser/components/places/src/Makefile
browser/components/preferences/Makefile
browser/components/privatebrowsing/Makefile
browser/components/privatebrowsing/src/Makefile
browser/components/search/Makefile
browser/components/sessionstore/Makefile
browser/components/sessionstore/src/Makefile

View File

@ -106,7 +106,32 @@
<handler event="dblclick" action="this._onDoubleClick();"/>
</handlers>
<implementation>
<implementation implements="nsIDOMEventListener">
<constructor>
<![CDATA[
window.addEventListener("MozContextUIExpand", this, true);
]]>
</constructor>
<destructor>
<![CDATA[
window.removeEventListener("MozContextUIExpand", this, true);
]]>
</destructor>
<method name="handleEvent">
<parameter name="event"/>
<body>
<![CDATA[
switch (event.type) {
case "MozContextUIExpand":
this.strip.ensureElementIsVisible(this.selectedTab, false);
break;
}
]]>
</body>
</method>
<field name="strip">document.getAnonymousElementByAttribute(this, "anonid", "tabs-scrollbox");</field>
<field name="_selectedTab">null</field>

View File

@ -13,43 +13,18 @@ var ContextMenuHandler = {
// Events we catch from content during the bubbling phase
addEventListener("contextmenu", this, false);
addEventListener("pagehide", this, false);
addEventListener("select", this, false);
// Messages we receive from browser
// Command sent over from browser that only we can handle.
addMessageListener("Browser:ContextCommand", this, false);
// InvokeContextAtPoint is sent to us from browser's selection
// overlay when it traps a contextmenu event. In response we
// should invoke context menu logic at the point specified.
addMessageListener("Browser:InvokeContextAtPoint", this, false);
this.popupNode = null;
},
_getLinkURL: function ch_getLinkURL(aLink) {
let href = aLink.href;
if (href)
return href;
href = aLink.getAttributeNS(kXLinkNamespace, "href");
if (!href || !href.match(/\S/)) {
// Without this we try to save as the current doc,
// for example, HTML case also throws if empty
throw "Empty href";
}
return Util.makeURLAbsolute(aLink.baseURI, href);
},
_getURI: function ch_getURI(aURL) {
try {
return Util.makeURI(aURL);
} catch (ex) { }
return null;
},
_getProtocol: function ch_getProtocol(aURI) {
if (aURI)
return aURI.scheme;
return null;
},
handleEvent: function ch_handleEvent(aEvent) {
switch (aEvent.type) {
case "contextmenu":
@ -58,12 +33,25 @@ var ContextMenuHandler = {
case "pagehide":
this.reset();
break;
case "select":
break;
}
},
receiveMessage: function ch_receiveMessage(aMessage) {
switch (aMessage.name) {
case "Browser:ContextCommand":
this._onContextCommand(aMessage);
break;
case "Browser:InvokeContextAtPoint":
this._onContextAtPoint(aMessage);
break;
}
},
/*
* Handler for commands send over from browser's ContextCommands.js
* in response to certain context menu actions only we can handle.
*/
_onContextCommand: function _onContextCommand(aMessage) {
let node = this.popupNode;
let command = aMessage.json.command;
@ -97,6 +85,17 @@ var ContextMenuHandler = {
}
},
/*
* Handler for selection overlay context menu events.
*/
_onContextAtPoint: function _onContextCommand(aMessage) {
// we need to find popupNode as if the context menu were
// invoked on underlying content.
let elem = elementFromPoint(aMessage.json.xPos, aMessage.json.yPos);
this._processPopupNode(elem, aMessage.json.xPos, aMessage.json.yPos,
Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH);
},
/******************************************************
* Event handlers
*/
@ -106,7 +105,7 @@ var ContextMenuHandler = {
this._target = null;
},
// content contextmenu
// content contextmenu handler
_onContentContextMenu: function _onContentContextMenu(aEvent) {
if (aEvent.defaultPrevented)
return;
@ -115,6 +114,80 @@ var ContextMenuHandler = {
aEvent.stopPropagation();
aEvent.preventDefault();
this._processPopupNode(aEvent.originalTarget, aEvent.clientX,
aEvent.clientY, aEvent.mozInputSource);
},
/******************************************************
* ContextCommand handlers
*/
_onSelectAll: function _onSelectAll() {
if (this._isTextInput(this._target)) {
// select all text in the input control
this._target.select();
} else {
// select the entire document
content.getSelection().selectAllChildren(content.document);
}
this.reset();
},
_onPaste: function _onPaste() {
// paste text if this is an input control
if (this._isTextInput(this._target)) {
let edit = this._target.QueryInterface(Ci.nsIDOMNSEditableElement);
if (edit) {
edit.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
} else {
Util.dumpLn("error: target element does not support nsIDOMNSEditableElement");
}
}
this.reset();
},
_onCopyImage: function _onCopyImage() {
Util.copyImageToClipboard(this._target);
},
/******************************************************
* Utility routines
*/
/*
* _translateToTopLevelWindow - Given a potential coordinate set within
* a subframe, translate up to the parent window which is what front
* end code expect.
*/
_translateToTopLevelWindow: function _translateToTopLevelWindow(aPopupNode) {
let offsetX = 0;
let offsetY = 0;
let element = aPopupNode;
while (element &&
element.ownerDocument &&
element.ownerDocument.defaultView != content) {
element = element.ownerDocument.defaultView.frameElement;
let rect = element.getBoundingClientRect();
offsetX += rect.left;
offsetY += rect.top;
}
return { offsetX: offsetX, offsetY: offsetY };
},
/*
* _processPopupNode - Generate and send a Content:ContextMenu message
* to browser detailing the underlying content types at this.popupNode.
* Note the event we receive targets the sub frame (if there is one) of
* the page.
*/
_processPopupNode: function _processPopupNode(aPopupNode, aX, aY, aInputSrc) {
if (!aPopupNode)
return;
let { offsetX: offsetX, offsetY: offsetY } =
this._translateToTopLevelWindow(aPopupNode);
let popupNode = this.popupNode = aPopupNode;
let imageUrl = "";
let state = {
types: [],
label: "",
@ -122,13 +195,8 @@ var ContextMenuHandler = {
linkTitle: "",
linkProtocol: null,
mediaURL: "",
x: aEvent.x,
y: aEvent.y
};
let popupNode = this.popupNode = aEvent.originalTarget;
let imageUrl = "";
// Do checks for nodes that never have children.
if (popupNode.nodeType == Ci.nsIDOMNode.ELEMENT_NODE) {
// See if the user clicked on an image.
@ -248,9 +316,9 @@ var ContextMenuHandler = {
}
// populate position and event source
state.xPos = aEvent.clientX;
state.yPos = aEvent.clientY;
state.source = aEvent.mozInputSource;
state.xPos = offsetX + aX;
state.yPos = offsetY + aY;
state.source = aInputSrc;
for (let i = 0; i < this._types.length; i++)
if (this._types[i].handler(state, popupNode))
@ -259,39 +327,6 @@ var ContextMenuHandler = {
sendAsyncMessage("Content:ContextMenu", state);
},
_onSelectAll: function _onSelectAll() {
if (this._isTextInput(this._target)) {
// select all text in the input control
this._target.select();
} else {
// select the entire document
content.getSelection().selectAllChildren(content.document);
}
this.reset();
},
_onPaste: function _onPaste() {
// paste text if this is an input control
if (this._isTextInput(this._target)) {
let edit = this._target.QueryInterface(Ci.nsIDOMNSEditableElement);
if (edit) {
edit.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
} else {
Util.dumpLn("error: target element does not support nsIDOMNSEditableElement");
}
}
this.reset();
},
_onCopyImage: function _onCopyImage() {
Util.copyImageToClipboard(this._target);
},
/*
* Utility routines used in testing for various
* HTML element types.
*/
_isTextInput: function _isTextInput(element) {
return ((element instanceof Ci.nsIDOMHTMLInputElement &&
element.mozIsTextField(false)) ||
@ -315,6 +350,35 @@ var ContextMenuHandler = {
element instanceof Ci.nsIDOMHTMLBodyElement);
},
_getLinkURL: function ch_getLinkURL(aLink) {
let href = aLink.href;
if (href)
return href;
href = aLink.getAttributeNS(kXLinkNamespace, "href");
if (!href || !href.match(/\S/)) {
// Without this we try to save as the current doc,
// for example, HTML case also throws if empty
throw "Empty href";
}
return Util.makeURLAbsolute(aLink.baseURI, href);
},
_getURI: function ch_getURI(aURL) {
try {
return Util.makeURI(aURL);
} catch (ex) { }
return null;
},
_getProtocol: function ch_getProtocol(aURI) {
if (aURI)
return aURI.scheme;
return null;
},
/**
* For add-ons to add new types and data to the ContextMenu message.
*

View File

@ -219,7 +219,7 @@ var TouchModule = {
this._targetScrollInterface = targetScrollInterface;
if (!this._targetScrollbox) {
return false;
return;
}
// XXX shouldn't dragger always be valid here?

View File

@ -24,15 +24,10 @@ let WeaveGlue = {
if (service.ready) {
this._init();
return;
} else {
Services.obs.addObserver(this, "weave:service:ready", false);
service.ensureLoaded();
}
Services.obs.addObserver(function onReady() {
Services.obs.removeObserver(onReady, "weave:service:ready");
this._init();
}.bind(this), "weave:service:ready", false);
service.ensureLoaded();
},
_init: function () {
@ -425,6 +420,12 @@ let WeaveGlue = {
},
observe: function observe(aSubject, aTopic, aData) {
if (aTopic == "weave:service:ready") {
Services.obs.removeObserver(this, aTopic);
this._init();
return;
}
// Make sure we're online when connecting/syncing
Util.forceOnline();

View File

@ -26,6 +26,8 @@ BROWSER_TESTS = \
browser_context_menu_tests.js \
browser_context_menu_tests_01.html \
browser_context_menu_tests_02.html \
browser_context_menu_tests_03.html \
text-block.html \
$(NULL)
BROWSER_TEST_RESOURCES = \

View File

@ -26,7 +26,6 @@ function emptyClipboard() {
.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
}
// Image context menu tests
gTests.push({
desc: "text context menu",
run: function test() {
@ -397,6 +396,119 @@ gTests.push({
}
});
gTests.push({
desc: "tests for subframe positioning",
run: function test() {
info(chromeRoot + "browser_context_menu_tests_03.html");
yield addTab(chromeRoot + "browser_context_menu_tests_03.html");
let win = Browser.selectedTab.browser.contentWindow;
// Sometimes the context ui is visible, sometimes it isn't.
try {
yield waitForCondition(function () {
return ContextUI.isVisible;
}, 500, 50);
} catch (ex) {}
ContextUI.dismiss();
let frame1 = win.document.getElementById("frame1");
let link1 = frame1.contentDocument.getElementById("link1");
let promise = waitForEvent(document, "popupshown");
sendContextMenuClickToElement(frame1.contentDocument.defaultView, link1, 85, 10);
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
// should be visible
ok(ContextMenuUI._menuPopup._visible, "is visible");
ok(ContextMenuUI._panel.left > 375 && ContextMenuUI._panel.left < 390, "position");
ok(ContextMenuUI._panel.top > 235 && ContextMenuUI._panel.top < 245, "position");
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
frame1.contentDocument.defaultView.scrollBy(0, 200);
promise = waitForEvent(document, "popupshown");
sendContextMenuClickToElement(frame1.contentDocument.defaultView, link1, 85, 10);
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
// should be visible
ok(ContextMenuUI._menuPopup._visible, "is visible");
ok(ContextMenuUI._panel.left > 375 && ContextMenuUI._panel.left < 390, "position");
ok(ContextMenuUI._panel.top > 35 && ContextMenuUI._panel.top < 45, "position");
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
let rlink1 = win.document.getElementById("rlink1");
promise = waitForEvent(document, "popupshown");
sendContextMenuClickToElement(win, rlink1, 40, 10);
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
// should be visible
ok(ContextMenuUI._menuPopup._visible, "is visible");
ok(ContextMenuUI._panel.left > 730 && ContextMenuUI._panel.left < 745, "position");
ok(ContextMenuUI._panel.top > 600 && ContextMenuUI._panel.top < 610, "position");
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
win.scrollBy(0, 200);
promise = waitForEvent(document, "popupshown");
sendContextMenuClickToElement(win, rlink1, 40, 10);
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
// should be visible
ok(ContextMenuUI._menuPopup._visible, "is visible");
ok(ContextMenuUI._panel.left > 730 && ContextMenuUI._panel.left < 745, "position");
ok(ContextMenuUI._panel.top > 400 && ContextMenuUI._panel.top < 410, "position");
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
let link2 = frame1.contentDocument.getElementById("link2");
promise = waitForEvent(document, "popupshown");
sendContextMenuClickToElement(frame1.contentDocument.defaultView, link2, 85, 10);
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
// should be visible
ok(ContextMenuUI._menuPopup._visible, "is visible");
info(ContextMenuUI._panel.left);
info(ContextMenuUI._panel.top);
ok(ContextMenuUI._panel.left > 380 && ContextMenuUI._panel.left < 390, "position");
ok(ContextMenuUI._panel.top > 170 && ContextMenuUI._panel.top < 185, "position");
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
ok(promise && !(promise instanceof Error), "promise error");
}
});
function test() {
runTests();
}

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
</head>
<body bgcolor=white>
Hello there. <a href="#hello">hello there.</a>
<center>
<iframe id="frame1" width="800" height="600" src="text-block.html"></iframe>
<br />
<br />
Hello there. <a id="rlink1" href="#hello">hello there.</a>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</center>
</body></html>

View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="content">
<p>(start of paragraph)
Alice was beginning to get very (break)<br>
tired of sitting by her sister on the bank, and of having nothing to do: once or twice she (span)
<span>(start of span) had peeped into the book her sister was reading (end of span)</span>,
but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice
`without pictures or conversation?' (break)<br>
(end of paragraph)</p>
(in between paragraphs)
<p>(start of paragraph)
Alice was beginning to get very
tired of sitting by her sister on the bank, and of having nothing to do: once or twice she
had peeped into the book her sister was reading, but it had no pictures or conversations
in it, `and what is the use of a book,' thought Alice `without pictures or conversation?'(break)<br>
(end of paragraph)</p>
<p><a id="link1" href="#hello">(start of paragraph)</a>
So she was considering in her own mind (as well as she could, for the hot day made her
feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth
the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink
eyes ran close by her. <br>
</p>
<p>
There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of
the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she
thought it over afterwards, it occurred to her that she ought to have wondered at this,
but at the time it all seemed quite natural); but when the Rabbit actually TOOK A WATCH
OUT OF ITS WAISTCOAT- POCKET, and looked at it, and then hurried on, Alice started to her
feet, for it flashed across her mind that she had never before seen a rabbit with either a
waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across
the field after it, and fortunately was just in time to see it pop down a large
rabbit-hole under the hedge. <br>
<br>
In another moment down went Alice after it, never once considering how in the world she
was to get out again. <br>
<br>
The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly
down, so suddenly that Alice had not a moment to think about stopping herself before she
found herself falling down a very deep well. <br>
<br><a id="link2" href="#hello">(start of paragraph)</a>
Either the well was very deep, or she fell very slowly, for she had plenty of time as she
went down to look about her and to wonder what was going to happen next. First, she tried
to look down and make out what she was coming to, but it was too dark to see anything;
then she looked at the sides of the well, and noticed that they were filled with cupboards
and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a
jar from one of the shelves as she passed; it was labelled `ORANGE MARMALADE', but to her
great disappointment it was empty: she did not like to drop the jar for fear of killing
somebody, so managed to put it into one of the cupboards as she fell past it. <br>
<br>
`Well!' thought Alice to herself, `after such a fall as this, I shall think nothing of
tumbling down stairs! How brave they'll all think me at home! Why, I wouldn't say anything
about it, even if I fell off the top of the house!' (Which was very likely true.) <br>
<br>
Down, down, down.
<br>
</div>
</body></html>

View File

@ -19,15 +19,8 @@ endif
export::
$(NSINSTALL) $(srcdir)/resources.pri $(DIST)/bin
$(RM) $(DIST)/bin/VisualElementsManifest.xml
$(PYTHON) $(topsrcdir)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME} \
$(srcdir)/VisualElementsManifest.xml.in > $(DIST)/bin/VisualElementsManifest.xml
install::
$(NSINSTALL) $(srcdir)/resources.pri $(DIST)/bin
# bug 744566
# $(RM) $(DIST)/bin/resources.pri
# $(MAKEPRI) new -v -pr $(srcdir)/tileresources -cf $(srcdir)/priconfig.xml -mn $(srcdir)/AppManifest.xml -of $(DIST)/bin/resources.pri -o
include $(topsrcdir)/config/rules.mk

View File

@ -57,13 +57,12 @@ this.Social = {
return this._provider;
},
set provider(val) {
// Changes triggered by the public setter should notify of an engine change.
this._setProvider(val, true);
this._setProvider(val);
},
// Sets the current provider and enables it. Also disables the
// previously set provider, and optionally notifies observers of the change.
_setProvider: function (provider, notify) {
// previously set provider, and notifies observers of the change.
_setProvider: function (provider) {
if (this._provider == provider)
return;
@ -84,10 +83,8 @@ this.Social = {
Services.prefs.setBoolPref("social.enabled", enabled);
}
if (notify) {
let origin = this._provider && this._provider.origin;
Services.obs.notifyObservers(null, "social:provider-set", origin);
}
let origin = this._provider && this._provider.origin;
Services.obs.notifyObservers(null, "social:provider-set", origin);
},
get defaultProvider() {
@ -97,41 +94,37 @@ this.Social = {
return provider || this.providers[0];
},
init: function Social_init(callback) {
init: function Social_init() {
this._disabledForSafeMode = Services.appinfo.inSafeMode && this.enabled;
if (this.providers) {
schedule(callback);
return;
}
// Retrieve the current set of providers, and set the current provider.
SocialService.getProviderList(function (providers) {
// We don't want to notify about a provider change when we're setting
// this.provider for the first time, so pass false here.
this._updateProviderCache(providers, false);
callback();
this._updateProviderCache(providers);
}.bind(this));
// Register an observer for changes to the provider list
SocialService.registerProviderListener(function providerListener(topic, data) {
// An engine change caused by adding/removing a provider should notify
if (topic == "provider-added" || topic == "provider-removed") {
this._updateProviderCache(data, true);
this._updateProviderCache(data);
Services.obs.notifyObservers(null, "social:providers-changed", null);
}
}.bind(this));
},
// Called to update our cache of providers and set the current provider
_updateProviderCache: function (providers, notifyProviderChange) {
_updateProviderCache: function (providers) {
this.providers = providers;
// If social is currently disabled there's nothing else to do.
if (!SocialService.enabled)
return;
// Otherwise set the provider.
this._setProvider(this.defaultProvider, notifyProviderChange);
this._setProvider(this.defaultProvider);
},
set enabled(val) {

View File

@ -94,6 +94,15 @@ if test "$CLANG_CXX"; then
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags"
fi
if test -z "$GNU_CC"; then
case "$target" in
*-mingw*)
## Warning 4099 (equivalent of mismatched-tags) is disabled (bug 780474)
## for the same reasons as above.
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -wd4099"
esac
fi
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"

View File

@ -825,6 +825,14 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
env['NS_TRACE_MALLOC_DISABLE_STACKS'] = '1'
# Additional temporary logging while we try to debug some intermittent
# WebRTC conditions. This is necessary to troubleshoot bugs 841496,
# 841150, and 839677 (at least)
env['NSPR_LOG_MODULES'] = 'signaling:3,mtransport:3'
env['R_LOG_LEVEL'] = '5'
env['R_LOG_DESTINATION'] = 'stderr'
env['R_LOG_VERBOSE'] = '1'
# ASan specific environment stuff
if self.IS_ASAN and (self.IS_LINUX or self.IS_MAC):
try:

View File

@ -7,6 +7,8 @@ pymake.pth:build/pymake
optional:setup.py:python/psutil:build_ext:--inplace
optional:psutil.pth:python/psutil
which.pth:python/which
ply.pth:other-licenses/ply/
codegen.pth:python/codegen/
mock.pth:python/mock-1.0.0
mozilla.pth:build
mozilla.pth:config

View File

@ -22,6 +22,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
var Ci = Components.interfaces;
if (navigator.platform.indexOf("Linux") == 0) {
SimpleTest.expectAssertions(2);
}
SimpleTest.waitForExplicitFinish();
/*

View File

@ -2157,8 +2157,9 @@ ia64*-hpux*)
# that behavior) that it's better to turn it off.
# MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
# on non-Western system locales even if it is in a comment.
# khuey says we can safely ignore MSVC warning C4251
CFLAGS="$CFLAGS -wd4819"
CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
CXXFLAGS="$CXXFLAGS -wd4251 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
# make 'foo == bar;' error out
CFLAGS="$CFLAGS -we4553"
CXXFLAGS="$CXXFLAGS -we4553"
@ -4672,7 +4673,7 @@ then
if test -z "$QTDIR"; then
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
MOZ_ENABLE_QT5=1,
MOZ_ENABLE_QT5=)
if test "$MOZ_ENABLE_QT5"; then
@ -4684,25 +4685,28 @@ then
AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
else
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
MOZ_QT_CFLAGS="-DQT_SHARED"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
HOST_MOC="$QTDIR/bin/moc"
HOST_RCC="$QTDIR/bin/rcc"
# QtWidgets was introduced only in Qt5
if test -d $QTDIR/include/QtWidgets; then
echo "Using qt5"
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
else
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
fi
HOST_MOC="$QTDIR/bin/moc"
HOST_RCC="$QTDIR/bin/rcc"
fi
if test -z "$HOST_MOC"; then
AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
@ -8971,7 +8975,7 @@ echo $MAKEFILES > unallmakefiles
AC_OUTPUT($MAKEFILES)
# target_arch is from {ia32|x64|arm}
# target_arch is from {ia32|x64|arm|ppc}
case "$CPU_ARCH" in
x86_64 | ia64)
WEBRTC_TARGET_ARCH=x64
@ -8985,6 +8989,9 @@ x86)
WEBRTC_TARGET_ARCH=ia32
;;
ppc*)
WEBRTC_TARGET_ARCH=ppc
;;
*)
# unsupported arch for webrtc
WEBRTC_TARGET_ARCH=unknown

View File

@ -102,8 +102,8 @@ template<typename> class Sequence;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x4e6f7d97, 0x091e, 0x4eda, \
{ 0xb7, 0xd6, 0xfe, 0xb0, 0xb8, 0x01, 0x2a, 0x93 } }
{ 0x45ce048f, 0x5970, 0x411e, \
{ 0xaa, 0x99, 0x12, 0xed, 0x3a, 0x55, 0xc9, 0xc3 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -886,7 +886,7 @@ public:
* so that all its fullscreen element stacks are empty; we must continue the
* rollback in this parent process' doc tree branch which is fullscreen.
* Note that only one branch of the document tree can have its documents in
* fullscreen state at one time. We're in inconsistent state if the a
* fullscreen state at one time. We're in inconsistent state if a
* fullscreen document has a parent and that parent isn't fullscreen. We
* preserve this property across process boundaries.
*/
@ -904,6 +904,25 @@ public:
*/
virtual bool IsFullScreenDoc() = 0;
/**
* Returns true if this document is a fullscreen leaf document, i.e. it
* is in fullscreen mode and has no fullscreen children.
*/
virtual bool IsFullscreenLeaf() = 0;
/**
* Returns the document which is at the root of this document's branch
* in the in-process document tree. Returns nullptr if the document isn't
* fullscreen.
*/
virtual nsIDocument* GetFullscreenRoot() = 0;
/**
* Sets the fullscreen root to aRoot. This stores a weak reference to aRoot
* in this document.
*/
virtual void SetFullscreenRoot(nsIDocument* aRoot) = 0;
/**
* Sets whether this document is approved for fullscreen mode.
* Documents aren't approved for fullscreen until chrome has sent a
@ -913,12 +932,14 @@ public:
virtual void SetApprovedForFullscreen(bool aIsApproved) = 0;
/**
* Exits all documents from DOM full-screen mode, and moves the top-level
* browser window out of full-screen mode. If aRunAsync is true, this runs
* asynchronously.
* Exits documents out of DOM fullscreen mode. If aDocument is non null,
* only its ancestors and descendants exit fullscreen, i.e. if there are
* multiple windows/doctrees in fullscreen mode, only the one containing
* aDocument exits fullscreen mode. If aDocument is null, all windows
* and documents exit fullscreen. If aRunAsync is true, fullscreen is
* executed asynchronously.
*/
static void ExitFullScreen(bool aRunAsync);
static void ExitFullscreen(nsIDocument* aDocument, bool aRunAsync);
virtual void RequestPointerLock(Element* aElement) = 0;

View File

@ -37,7 +37,7 @@ interface nsIFrame;
* Web IDL interfaces to mirror this interface when changing it.
*/
[scriptable, builtinclass, uuid(497bfb9b-d996-4d1e-a647-8137b0cfc876)]
[scriptable, builtinclass, uuid(e3968acd-b796-4ca3-aec0-e7f0880f2219)]
interface nsIImageLoadingContent : imgINotificationObserver
{
/**
@ -159,4 +159,12 @@ interface nsIImageLoadingContent : imgINotificationObserver
* as PR_FALSE to revert ImageState() to its original behaviour.
*/
void forceImageState(in boolean aForce, in unsigned long long aState);
/**
* A visible count is stored, if it is non-zero then this image is considered
* visible. These methods increment, decrement, or return the visible coount.
*/
[noscript, notxpcom] void IncrementVisibleCount();
[noscript, notxpcom] void DecrementVisibleCount();
[noscript, notxpcom] uint32_t GetVisibleCount();
};

View File

@ -1298,7 +1298,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
nsContentUtils::eDOM_PROPERTIES,
"RemovedFullScreenElement");
// Fully exit full-screen.
nsIDocument::ExitFullScreen(false);
nsIDocument::ExitFullscreen(OwnerDoc(), /* async */ false);
}
if (HasPointerLock()) {
nsIDocument::UnlockPointer();

View File

@ -195,13 +195,6 @@ using namespace mozilla::dom;
typedef nsTArray<Link*> LinkArray;
// Reference to the document which requested DOM full-screen mode.
nsWeakPtr nsDocument::sFullScreenDoc = nullptr;
// Reference to the root document of the branch containing the document
// which requested DOM full-screen mode.
nsWeakPtr nsDocument::sFullScreenRootDoc = nullptr;
#ifdef PR_LOGGING
static PRLogModuleInfo* gDocumentLeakPRLog;
static PRLogModuleInfo* gCspPRLog;
@ -7782,18 +7775,26 @@ nsDocument::OnPageHide(bool aPersisted,
EnumerateFreezableElements(NotifyActivityChanged, nullptr);
if (IsFullScreenDoc()) {
// A full-screen doc has been hidden. We need to ensure we exit
// full-screen, i.e. remove full-screen state from all full-screen
// documents, and exit the top-level window from full-screen mode.
// By the time a doc is hidden, it has been removed from the doc tree,
// so nsIDocument::ExitFullScreen() won't be able to traverse to this
// document to reset its state, so reset full-screen state in *this*
// document. OnPageHide() is called in every hidden document, so doing
// this ensures all hidden documents have their full-screen state reset.
CleanupFullscreenState();
// If this document was fullscreen, we should exit fullscreen in this
// doctree branch. This ensures that if the user navigates while in
// fullscreen mode we don't leave its still visible ancestor documents
// in fullscreen mode. So exit fullscreen in the document's fullscreen
// root document, as this will exit fullscreen in all the root's
// descendant documents. Note that documents are removed from the
// doctree by the time OnPageHide() is called, so we must store a
// reference to the root (in nsDocument::mFullscreenRoot) since we can't
// just traverse the doctree to get the root.
nsIDocument::ExitFullscreen(this, /* async */ false);
// Next reset full-screen state in all visible documents in the doctree.
nsIDocument::ExitFullScreen(false);
// Since the document is removed from the doctree before OnPageHide() is
// called, ExitFullscreen() can't traverse from the root down to *this*
// document, so we must manually call CleanupFullscreenState() below too.
// Note that CleanupFullscreenState() clears nsDocument::mFullscreenRoot,
// so we *must* call it after ExitFullscreen(), not before.
// OnPageHide() is called in every hidden (i.e. descendant) document,
// so calling CleanupFullscreenState() here will ensure all hidden
// documents have their fullscreen state reset.
CleanupFullscreenState();
}
}
@ -8966,136 +8967,6 @@ nsIDocument::CreateTouchList(const Sequence<nsRefPtr<nsIDOMTouch> >& aTouches)
return retval.forget();
}
static void
DispatchFullScreenChange(nsIDocument* aTarget)
{
nsRefPtr<nsAsyncDOMEvent> e =
new nsAsyncDOMEvent(aTarget,
NS_LITERAL_STRING("mozfullscreenchange"),
true,
false);
e->PostDOMEvent();
}
NS_IMETHODIMP
nsDocument::MozCancelFullScreen()
{
nsIDocument::MozCancelFullScreen();
return NS_OK;
}
void
nsIDocument::MozCancelFullScreen()
{
// Only perform fullscreen changes if we're running in a webapp
// same-origin to the web app, or if we're in a user generated event
// handler.
if (NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED ||
nsContentUtils::IsRequestFullScreenAllowed()) {
RestorePreviousFullScreenState();
}
}
// Runnable to set window full-screen mode. Used as a script runner
// to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to
// run script. nsGlobalWindow::SetFullScreen() dispatches a synchronous event
// (handled in chome code) which is unsafe to run if this is called in
// Element::UnbindFromTree().
class nsSetWindowFullScreen : public nsRunnable {
public:
nsSetWindowFullScreen(nsIDocument* aDoc, bool aValue)
: mDoc(aDoc), mValue(aValue) {}
NS_IMETHOD Run()
{
if (mDoc->GetWindow()) {
mDoc->GetWindow()->SetFullScreenInternal(mValue, false);
}
return NS_OK;
}
private:
nsCOMPtr<nsIDocument> mDoc;
bool mValue;
};
static void
SetWindowFullScreen(nsIDocument* aDoc, bool aValue)
{
nsContentUtils::AddScriptRunner(new nsSetWindowFullScreen(aDoc, aValue));
}
class nsCallExitFullScreen : public nsRunnable {
public:
NS_IMETHOD Run()
{
nsDocument::ExitFullScreen();
return NS_OK;
}
};
/* static */
void
nsIDocument::ExitFullScreen(bool aRunAsync)
{
if (aRunAsync) {
NS_DispatchToCurrentThread(new nsCallExitFullScreen());
return;
}
nsDocument::ExitFullScreen();
}
// Returns true if the document is a direct child of a cross process parent
// mozbrowser iframe. This is the case when the document has a null parent,
// and its DocShell reports that it is a browser frame.
static bool
HasCrossProcessParent(nsIDocument* aDocument)
{
if (XRE_GetProcessType() != GeckoProcessType_Content) {
return false;
}
if (aDocument->GetParentDocument() != nullptr) {
return false;
}
nsPIDOMWindow* win = aDocument->GetWindow();
if (!win) {
return false;
}
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();
if (!docShell) {
return false;
}
return docShell->GetIsBrowserOrApp();
}
static bool
ResetFullScreen(nsIDocument* aDocument, void* aData)
{
if (aDocument->IsFullScreenDoc()) {
static_cast<nsDocument*>(aDocument)->CleanupFullscreenState();
NS_ASSERTION(!aDocument->IsFullScreenDoc(), "Should reset full-screen");
nsTArray<nsIDocument*>* changed = reinterpret_cast<nsTArray<nsIDocument*>*>(aData);
changed->AppendElement(aDocument);
if (HasCrossProcessParent(aDocument)) {
// We're at the top of the content-process side doc tree. Ask the parent
// process to exit fullscreen.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
os->NotifyObservers(aDocument, "ask-parent-to-exit-fullscreen", nullptr);
}
// Dispatch a notification so that if this document has any
// cross-process subdocuments, they'll be notified to exit fullscreen.
// The BrowserElementParent listens for this event and performs the
// cross process notification if it has a remote child process.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
os->NotifyObservers(aDocument, "ask-children-to-exit-fullscreen", nullptr);
aDocument->EnumerateSubDocuments(ResetFullScreen, aData);
}
return true;
}
already_AddRefed<nsDOMCaretPosition>
nsIDocument::CaretPositionFromPoint(float aX, float aY)
{
@ -9158,34 +9029,351 @@ nsDocument::CaretPositionFromPoint(float aX, float aY, nsISupports** aCaretPos)
return NS_OK;
}
namespace mozilla {
// Singleton class to manage the list of fullscreen documents which are the
// root of a branch which contains fullscreen documents. We maintain this list
// so that we can easily exit all windows from fullscreen when the user
// presses the escape key.
class FullscreenRoots {
public:
// Adds a root to the manager. Adding a root multiple times does not result
// in duplicate entries for that item, only one.
static void Add(nsIDocument* aRoot);
// Iterates over every root in the root list, and calls aFunction, passing
// each root once to aFunction. It is safe to call Add() and Remove() while
// iterating over the list (i.e. in aFunction). Documents that are removed
// from the manager during traversal are not traversed, and documents that
// are added to the manager during traversal are also not traversed.
static void ForEach(void(*aFunction)(nsIDocument* aDoc));
// Removes a specific root from the manager.
static void Remove(nsIDocument* aRoot);
// Returns true if all roots added to the list have been removed.
static bool IsEmpty();
private:
FullscreenRoots() {
MOZ_COUNT_CTOR(FullscreenRoots);
}
~FullscreenRoots() {
MOZ_COUNT_DTOR(FullscreenRoots);
}
enum {
NotFound = uint32_t(-1)
};
// Looks in mRoots for aRoot. Returns the index if found, otherwise NotFound.
static uint32_t Find(nsIDocument* aRoot);
// Returns true if aRoot is in the list of fullscreen roots.
static bool Contains(nsIDocument* aRoot);
// Singleton instance of the FullscreenRoots. This is instantiated when a
// root is added, and it is deleted when the last root is removed.
static FullscreenRoots* sInstance;
// List of weak pointers to roots.
nsTArray<nsWeakPtr> mRoots;
};
FullscreenRoots* FullscreenRoots::sInstance = nullptr;
/* static */
void
nsDocument::ExitFullScreen()
FullscreenRoots::ForEach(void(*aFunction)(nsIDocument* aDoc))
{
// Clear full-screen stacks in all descendant documents.
nsCOMPtr<nsIDocument> root(do_QueryReferent(sFullScreenRootDoc));
if (!sInstance) {
return;
}
// Create a copy of the roots array, and iterate over the copy. This is so
// that if an element is removed from mRoots we don't mess up our iteration.
nsTArray<nsWeakPtr> roots(sInstance->mRoots);
// Call aFunction on all entries.
for (uint32_t i = 0; i < roots.Length(); i++) {
nsCOMPtr<nsIDocument> root = do_QueryReferent(roots[i]);
// Check that the root isn't in the manager. This is so that new additions
// while we were running don't get traversed.
if (root && FullscreenRoots::Contains(root)) {
aFunction(root);
}
}
}
/* static */
bool
FullscreenRoots::Contains(nsIDocument* aRoot)
{
return FullscreenRoots::Find(aRoot) != NotFound;
}
/* static */
void
FullscreenRoots::Add(nsIDocument* aRoot)
{
if (!FullscreenRoots::Contains(aRoot)) {
if (!sInstance) {
sInstance = new FullscreenRoots();
}
sInstance->mRoots.AppendElement(do_GetWeakReference(aRoot));
}
}
/* static */
uint32_t
FullscreenRoots::Find(nsIDocument* aRoot)
{
if (!sInstance) {
return NotFound;
}
nsTArray<nsWeakPtr>& roots = sInstance->mRoots;
for (uint32_t i = 0; i < roots.Length(); i++) {
nsCOMPtr<nsIDocument> otherRoot(do_QueryReferent(roots[i]));
if (otherRoot == aRoot) {
return i;
}
}
return NotFound;
}
/* static */
void
FullscreenRoots::Remove(nsIDocument* aRoot)
{
uint32_t index = Find(aRoot);
NS_ASSERTION(index != NotFound,
"Should only try to remove roots which are still added!");
if (index == NotFound || !sInstance) {
return;
}
sInstance->mRoots.RemoveElementAt(index);
if (sInstance->mRoots.IsEmpty()) {
delete sInstance;
sInstance = nullptr;
}
}
/* static */
bool
FullscreenRoots::IsEmpty()
{
return !sInstance;
}
} // end namespace mozilla.
using mozilla::FullscreenRoots;
nsIDocument*
nsDocument::GetFullscreenRoot()
{
nsCOMPtr<nsIDocument> root = do_QueryReferent(mFullscreenRoot);
return root;
}
void
nsDocument::SetFullscreenRoot(nsIDocument* aRoot)
{
mFullscreenRoot = do_GetWeakReference(aRoot);
}
static void
DispatchFullScreenChange(nsIDocument* aTarget)
{
nsRefPtr<nsAsyncDOMEvent> e =
new nsAsyncDOMEvent(aTarget,
NS_LITERAL_STRING("mozfullscreenchange"),
true,
false);
e->PostDOMEvent();
}
NS_IMETHODIMP
nsDocument::MozCancelFullScreen()
{
nsIDocument::MozCancelFullScreen();
return NS_OK;
}
void
nsIDocument::MozCancelFullScreen()
{
// Only perform fullscreen changes if we're running in a webapp
// same-origin to the web app, or if we're in a user generated event
// handler.
if (NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED ||
nsContentUtils::IsRequestFullScreenAllowed()) {
RestorePreviousFullScreenState();
}
}
// Runnable to set window full-screen mode. Used as a script runner
// to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to
// run script. nsGlobalWindow::SetFullScreen() dispatches a synchronous event
// (handled in chome code) which is unsafe to run if this is called in
// Element::UnbindFromTree().
class nsSetWindowFullScreen : public nsRunnable {
public:
nsSetWindowFullScreen(nsIDocument* aDoc, bool aValue)
: mDoc(aDoc), mValue(aValue) {}
NS_IMETHOD Run()
{
if (mDoc->GetWindow()) {
mDoc->GetWindow()->SetFullScreenInternal(mValue, false);
}
return NS_OK;
}
private:
nsCOMPtr<nsIDocument> mDoc;
bool mValue;
};
static void
SetWindowFullScreen(nsIDocument* aDoc, bool aValue)
{
// Maintain list of fullscreen root documents.
nsCOMPtr<nsIDocument> root = nsContentUtils::GetRootDocument(aDoc);
if (aValue) {
FullscreenRoots::Add(root);
} else {
FullscreenRoots::Remove(root);
}
nsContentUtils::AddScriptRunner(new nsSetWindowFullScreen(aDoc, aValue));
}
class nsCallExitFullscreen : public nsRunnable {
public:
nsCallExitFullscreen(nsIDocument* aDoc)
: mDoc(aDoc) {}
NS_IMETHOD Run()
{
nsDocument::ExitFullscreen(mDoc);
return NS_OK;
}
private:
nsCOMPtr<nsIDocument> mDoc;
};
/* static */
void
nsIDocument::ExitFullscreen(nsIDocument* aDoc, bool aRunAsync)
{
if (aDoc && !aDoc->IsFullScreenDoc()) {
return;
}
if (aRunAsync) {
NS_DispatchToCurrentThread(new nsCallExitFullscreen(aDoc));
return;
}
nsDocument::ExitFullscreen(aDoc);
}
// Returns true if the document is a direct child of a cross process parent
// mozbrowser iframe. This is the case when the document has a null parent,
// and its DocShell reports that it is a browser frame.
static bool
HasCrossProcessParent(nsIDocument* aDocument)
{
if (XRE_GetProcessType() != GeckoProcessType_Content) {
return false;
}
if (aDocument->GetParentDocument() != nullptr) {
return false;
}
nsPIDOMWindow* win = aDocument->GetWindow();
if (!win) {
return false;
}
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();
if (!docShell) {
return false;
}
return docShell->GetIsBrowserOrApp();
}
static bool
CountFullscreenSubDocuments(nsIDocument* aDoc, void* aData)
{
if (aDoc->IsFullScreenDoc()) {
uint32_t* count = static_cast<uint32_t*>(aData);
(*count)++;
}
return true;
}
static uint32_t
CountFullscreenSubDocuments(nsIDocument* aDoc)
{
uint32_t count = 0;
aDoc->EnumerateSubDocuments(CountFullscreenSubDocuments, &count);
return count;
}
bool
nsDocument::IsFullscreenLeaf()
{
// A fullscreen leaf document is fullscreen, and has no fullscreen
// subdocuments.
if (!IsFullScreenDoc()) {
return false;
}
return CountFullscreenSubDocuments(this) == 0;
}
static bool
ResetFullScreen(nsIDocument* aDocument, void* aData)
{
if (aDocument->IsFullScreenDoc()) {
NS_ASSERTION(CountFullscreenSubDocuments(aDocument) <= 1,
"Should have at most 1 fullscreen subdocument.");
static_cast<nsDocument*>(aDocument)->CleanupFullscreenState();
NS_ASSERTION(!aDocument->IsFullScreenDoc(), "Should reset full-screen");
nsTArray<nsIDocument*>* changed = reinterpret_cast<nsTArray<nsIDocument*>*>(aData);
changed->AppendElement(aDocument);
if (HasCrossProcessParent(aDocument)) {
// We're at the top of the content-process side doc tree. Ask the parent
// process to exit fullscreen.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
os->NotifyObservers(aDocument, "ask-parent-to-exit-fullscreen", nullptr);
}
// Dispatch a notification so that if this document has any
// cross-process subdocuments, they'll be notified to exit fullscreen.
// The BrowserElementParent listens for this event and performs the
// cross process notification if it has a remote child process.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
os->NotifyObservers(aDocument, "ask-children-to-exit-fullscreen", nullptr);
aDocument->EnumerateSubDocuments(ResetFullScreen, aData);
}
return true;
}
static void
ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc)
{
MOZ_ASSERT(aMaybeNotARootDoc);
nsCOMPtr<nsIDocument> root = aMaybeNotARootDoc->GetFullscreenRoot();
NS_ASSERTION(root, "Should have root when in fullscreen!");
if (!root) {
// Not in full-screen mode.
return;
}
NS_ASSERTION(root->IsFullScreenDoc(),
"Full-screen root should be a full-screen doc...");
"Fullscreen root should be a fullscreen doc...");
// Stores a list of documents to which we must dispatch "mozfullscreenchange".
// We're required by the spec to dispatch the events in leaf-to-root
// order when exiting full-screen, but we traverse the doctree in a
// order when exiting fullscreen, but we traverse the doctree in a
// root-to-leaf order, so we save references to the documents we must
// dispatch to so that we dispatch in the specified order.
nsAutoTArray<nsIDocument*, 8> changed;
// We may also need to unlock the pointer, if it's locked.
nsCOMPtr<Element> pointerLockedElement =
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
if (pointerLockedElement) {
UnlockPointer();
}
// Walk the tree of full-screen documents, and reset their full-screen state.
// Walk the tree of fullscreen documents, and reset their fullscreen state.
ResetFullScreen(root, static_cast<void*>(&changed));
// Dispatch "mozfullscreenchange" events. Note this loop is in reverse
@ -9195,23 +9383,75 @@ nsDocument::ExitFullScreen()
DispatchFullScreenChange(changed[changed.Length() - i - 1]);
}
// Reset global state. Do this before we move the window out of full-screen
// mode, as that calls nsGlobalWindow::SetFullScreen() which calls back into
// nsIDocument::ExitFullScreen().
sFullScreenRootDoc = nullptr;
sFullScreenDoc = nullptr;
NS_ASSERTION(!root->IsFullScreenDoc(),
"Fullscreen root should no longer be a fullscreen doc...");
// Move the top-level window out of full-screen mode.
// Move the top-level window out of fullscreen mode.
SetWindowFullScreen(root, false);
}
/* static */
void
nsDocument::ExitFullscreen(nsIDocument* aDoc)
{
// Unlock the pointer, if it's locked.
nsCOMPtr<Element> pointerLockedElement =
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
if (pointerLockedElement) {
UnlockPointer();
}
if (aDoc) {
ExitFullscreenInDocTree(aDoc);
return;
}
// Clear fullscreen stacks in all fullscreen roots' descendant documents.
FullscreenRoots::ForEach(&ExitFullscreenInDocTree);
NS_ASSERTION(FullscreenRoots::IsEmpty(),
"Should have exited all fullscreen roots from fullscreen");
}
bool
GetFullscreenLeaf(nsIDocument* aDoc, void* aData)
{
if (aDoc->IsFullscreenLeaf()) {
nsIDocument** result = static_cast<nsIDocument**>(aData);
*result = aDoc;
return false;
} else if (aDoc->IsFullScreenDoc()) {
aDoc->EnumerateSubDocuments(GetFullscreenLeaf, aData);
}
return true;
}
static nsIDocument*
GetFullscreenLeaf(nsIDocument* aDoc)
{
nsIDocument* leaf = nullptr;
GetFullscreenLeaf(aDoc, &leaf);
if (leaf) {
return leaf;
}
// Otherwise we could be either in a non-fullscreen doc tree, or we're
// below the fullscreen doc. Start the search from the root.
nsIDocument* root = nsContentUtils::GetRootDocument(aDoc);
// Check that the root is actually fullscreen so we don't waste time walking
// around its descendants.
if (!root->IsFullScreenDoc()) {
return nullptr;
}
GetFullscreenLeaf(root, &leaf);
return leaf;
}
void
nsDocument::RestorePreviousFullScreenState()
{
NS_ASSERTION(!IsFullScreenDoc() || sFullScreenDoc != nullptr,
"Should have a full-screen doc when full-screen!");
NS_ASSERTION(!IsFullScreenDoc() || !FullscreenRoots::IsEmpty(),
"Should have at least 1 fullscreen root when fullscreen!");
if (!IsFullScreenDoc() || !GetWindow() || !sFullScreenDoc) {
if (!IsFullScreenDoc() || !GetWindow() || FullscreenRoots::IsEmpty()) {
return;
}
@ -9222,7 +9462,7 @@ nsDocument::RestorePreviousFullScreenState()
UnlockPointer();
}
nsCOMPtr<nsIDocument> fullScreenDoc(do_QueryReferent(sFullScreenDoc));
nsCOMPtr<nsIDocument> fullScreenDoc = GetFullscreenLeaf(this);
// The fullscreen document may contain a <iframe mozbrowser> element which
// has a cross process child. So send a notification so that its browser
@ -9289,18 +9529,15 @@ nsDocument::RestorePreviousFullScreenState()
os->NotifyObservers(root, "fullscreen-origin-change", origin.get());
}
sFullScreenDoc = do_GetWeakReference(doc);
break;
}
}
if (doc == nullptr) {
// We moved all documents out of full-screen mode, reset global full-screen
// state and move the top-level window out of full-screen mode.
DebugOnly< nsCOMPtr<nsIDocument> > root(do_QueryReferent(sFullScreenRootDoc));
NS_ASSERTION(!root->IsFullScreenDoc(), "Should have cleared all docs' stacks");
sFullScreenDoc = nullptr;
sFullScreenRootDoc = nullptr;
// We moved all documents in this doctree out of fullscreen mode,
// move the top-level window out of fullscreen mode.
NS_ASSERTION(!nsContentUtils::GetRootDocument(this)->IsFullScreenDoc(),
"Should have cleared all docs' stacks");
SetWindowFullScreen(this, false);
}
}
@ -9369,24 +9606,33 @@ LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
nsresult
nsDocument::AddFullscreenApprovedObserver()
{
NS_ASSERTION(!mHasFullscreenApprovedObserver, "Don't add observer twice.");
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
NS_ENSURE_TRUE(os, NS_ERROR_FAILURE);
nsresult res = os->AddObserver(this, "fullscreen-approved", true);
NS_ENSURE_SUCCESS(res, res);
mHasFullscreenApprovedObserver = true;
return NS_OK;
}
nsresult
nsDocument::RemoveFullscreenApprovedObserver()
{
if (!mHasFullscreenApprovedObserver) {
return NS_OK;
}
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
NS_ENSURE_TRUE(os, NS_ERROR_FAILURE);
nsresult res = os->RemoveObserver(this, "fullscreen-approved");
NS_ENSURE_SUCCESS(res, res);
mHasFullscreenApprovedObserver = false;
return NS_OK;
}
@ -9406,6 +9652,7 @@ nsDocument::CleanupFullscreenState()
}
SetApprovedForFullscreen(false);
RemoveFullscreenApprovedObserver();
mFullscreenRoot = nullptr;
}
bool
@ -9584,7 +9831,7 @@ nsDocument::RequestFullScreen(Element* aElement,
if (GetFullScreenElement() &&
!nsContentUtils::ContentIsDescendantOf(aElement, GetFullScreenElement())) {
// If this document is full-screen, only grant full-screen requests from
// a descendent of the current full-screen element.
// a descendant of the current full-screen element.
LogFullScreenDenied(true, "FullScreenDeniedNotDescendant", this);
return;
}
@ -9608,6 +9855,10 @@ nsDocument::RequestFullScreen(Element* aElement,
}
}
// Stash a reference to any existing fullscreen doc, we'll use this later
// to detect if the origin which is fullscreen has changed.
nsCOMPtr<nsIDocument> previousFullscreenDoc = GetFullscreenLeaf(this);
AddFullscreenApprovedObserver();
// Stores a list of documents which we must dispatch "mozfullscreenchange"
@ -9620,11 +9871,9 @@ nsDocument::RequestFullScreen(Element* aElement,
// Remember the root document, so that if a full-screen document is hidden
// we can reset full-screen state in the remaining visible full-screen documents.
nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this);
sFullScreenRootDoc = do_GetWeakReference(fullScreenRootDoc);
// If a document is already in fullscreen, then unlock the mouse pointer
// before setting a new document to fullscreen
if (sFullScreenDoc) {
if (fullScreenRootDoc->IsFullScreenDoc()) {
// A document is already in fullscreen, unlock the mouse pointer
// before setting a new document to fullscreen
UnlockPointer();
}
@ -9650,6 +9899,9 @@ nsDocument::RequestFullScreen(Element* aElement,
// visible there. Stop when we reach the root document.
nsIDocument* child = this;
while (true) {
child->SetFullscreenRoot(fullScreenRootDoc);
NS_ASSERTION(child->GetFullscreenRoot() == fullScreenRootDoc,
"Fullscreen root should be set!");
nsIDocument* parent = child->GetParentDocument();
if (!parent) {
break;
@ -9689,7 +9941,6 @@ nsDocument::RequestFullScreen(Element* aElement,
// If this document, or a document with the same principal has not
// already been approved for fullscreen this fullscreen-session, dispatch
// an event so that chrome knows to pop up a warning/approval UI.
nsCOMPtr<nsIDocument> previousFullscreenDoc(do_QueryReferent(sFullScreenDoc));
// Note previousFullscreenDoc=nullptr upon first entry, so we always
// take this path on the first time we enter fullscreen in a fullscreen
// session.
@ -9703,10 +9954,6 @@ nsDocument::RequestFullScreen(Element* aElement,
e->PostDOMEvent();
}
// Remember this is the requesting full-screen document.
sFullScreenDoc = do_GetWeakReference(static_cast<nsIDocument*>(this));
NS_ASSERTION(sFullScreenDoc, "nsDocument should support weak ref!");
#ifdef DEBUG
// Note assertions must run before SetWindowFullScreen() as that does
// synchronous event dispatch which can run script which exits full-screen!
@ -9802,24 +10049,12 @@ nsDocument::MozFullScreenEnabled()
return IsFullScreenEnabled(nsContentUtils::IsCallerChrome(), false);
}
static bool
HasFullScreenSubDocument(nsIDocument* aDoc, void* aData)
{
if (aDoc->IsFullScreenDoc()) {
// This subdocument is full-screen. Set result and return false to
// stop iteration.
*static_cast<bool*>(aData) = true;
return false;
}
return true;
}
static bool
HasFullScreenSubDocument(nsIDocument* aDoc)
{
bool result = false;
aDoc->EnumerateSubDocuments(&HasFullScreenSubDocument, static_cast<void*>(&result));
return result;
uint32_t count = CountFullscreenSubDocuments(aDoc);
NS_ASSERTION(count <= 1, "Fullscreen docs should have at most 1 fullscreen child!");
return count >= 1;
}
bool

View File

@ -943,14 +943,17 @@ public:
virtual Element* GetFullScreenElement();
virtual void AsyncRequestFullScreen(Element* aElement);
virtual void RestorePreviousFullScreenState();
virtual bool IsFullscreenLeaf();
virtual bool IsFullScreenDoc();
virtual void SetApprovedForFullscreen(bool aIsApproved);
virtual nsresult RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
const nsAString& aNewOrigin);
virtual nsresult RemoteFrameFullscreenReverted();
virtual nsIDocument* GetFullscreenRoot();
virtual void SetFullscreenRoot(nsIDocument* aRoot);
static void ExitFullScreen();
static void ExitFullscreen(nsIDocument* aDoc);
// This is called asynchronously by nsIDocument::AsyncRequestFullScreen()
// to move this document into full-screen mode if allowed. aWasCallerChrome
@ -1163,17 +1166,6 @@ protected:
// is a weak reference to avoid leaks due to circular references.
nsWeakPtr mScopeObject;
// The document which requested (and was granted) full-screen. All ancestors
// of this document will also be full-screen.
static nsWeakPtr sFullScreenDoc;
// The root document of the doctree containing the document which requested
// full-screen. This root document will also be in full-screen state, as will
// all the descendents down to the document which requested full-screen. This
// reference allows us to reset full-screen state on all documents when a
// document is hidden/navigation occurs.
static nsWeakPtr sFullScreenRootDoc;
// Weak reference to the document which owned the pending pointer lock
// element, at the time it requested pointer lock.
static nsWeakPtr sPendingPointerLockDoc;
@ -1188,6 +1180,10 @@ protected:
// pop one off this stack, restoring the previous full-screen state
nsTArray<nsWeakPtr> mFullScreenStack;
// The root of the doc tree in which this document is in. This is only
// non-null when this document is in fullscreen mode.
nsWeakPtr mFullscreenRoot;
nsRefPtr<nsEventListenerManager> mListenerManager;
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
nsRefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
@ -1257,6 +1253,11 @@ protected:
// permissions in the permission manager) have been approved for fullscreen.
bool mIsApprovedForFullscreen:1;
// Whether this document has a fullscreen approved observer. Only documents
// which request fullscreen and which don't have a pre-existing approval for
// fullscreen will have an observer.
bool mHasFullscreenApprovedObserver:1;
uint8_t mXMLDeclarationBits;
nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject> *mBoxObjectTable;

View File

@ -86,7 +86,7 @@
#include "sampler.h"
#include "jsapi.h"
#include "nsHTMLIFrameElement.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "nsSandboxFlags.h"
#include "mozilla/dom/StructuredCloneUtils.h"
@ -450,8 +450,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
// Is this an <iframe> with a sandbox attribute or a parent which is
// sandboxed ?
nsHTMLIFrameElement* iframe =
nsHTMLIFrameElement::FromContent(mOwnerContent);
HTMLIFrameElement* iframe =
HTMLIFrameElement::FromContent(mOwnerContent);
uint32_t sandboxFlags = 0;

View File

@ -86,7 +86,8 @@ nsImageLoadingContent::nsImageLoadingContent()
mNewRequestsWillNeedAnimationReset(false),
mStateChangerDepth(0),
mCurrentRequestRegistered(false),
mPendingRequestRegistered(false)
mPendingRequestRegistered(false),
mVisibleCount(0)
{
if (!nsContentUtils::GetImgLoaderForChannel(nullptr)) {
mLoadingEnabled = false;
@ -121,6 +122,11 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
return OnImageIsAnimated(aRequest);
}
if (aType == imgINotificationObserver::UNLOCKED_DRAW) {
OnUnlockedDraw();
return NS_OK;
}
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
// We should definitely have a request here
NS_ABORT_IF_FALSE(aRequest, "no request?");
@ -228,6 +234,25 @@ nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
return NS_OK;
}
void
nsImageLoadingContent::OnUnlockedDraw()
{
if (mVisibleCount > 0) {
// We should already be marked as visible, there is nothing more we can do.
return;
}
nsPresContext* presContext = GetFramePresContext();
if (!presContext)
return;
nsIPresShell* presShell = presContext->PresShell();
if (!presShell)
return;
presShell->EnsureImageInVisibleList(this);
}
nsresult
nsImageLoadingContent::OnImageIsAnimated(imgIRequest *aRequest)
{
@ -375,25 +400,23 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "aFrame is null");
if (aFrame->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
// Assume all images in popups are visible.
IncrementVisibleCount();
}
nsPresContext* presContext = aFrame->PresContext();
if (mVisibleCount == 0) {
presContext->PresShell()->EnsureImageInVisibleList(this);
}
// We pass the SKIP_FRAME_CHECK flag to TrackImage here because our primary
// frame pointer hasn't been setup yet when this is caled.
TrackImage(mCurrentRequest, SKIP_FRAME_CHECK);
TrackImage(mPendingRequest, SKIP_FRAME_CHECK);
// We need to make sure that our image request is registered, if it should
// be registered.
nsPresContext* presContext = aFrame->PresContext();
if (mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mCurrentRequest);
}
}
if (mPendingRequest && !(mPendingRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mPendingRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mPendingRequest);
}
}
if (mCurrentRequest) {
nsLayoutUtils::RegisterImageRequestIfAnimated(presContext, mCurrentRequest,
&mCurrentRequestRegistered);
@ -423,19 +446,13 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
&mPendingRequestRegistered);
}
if (mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest);
}
}
if (mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest);
}
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);
if (aFrame->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
// We assume all images in popups are visible, so this decrement balances
// out the increment in FrameCreated above.
DecrementVisibleCount();
}
}
@ -614,6 +631,34 @@ nsImageLoadingContent::UnblockOnload(imgIRequest* aRequest)
return NS_OK;
}
void
nsImageLoadingContent::IncrementVisibleCount()
{
mVisibleCount++;
if (mVisibleCount == 1) {
TrackImage(mCurrentRequest);
TrackImage(mPendingRequest);
}
}
void
nsImageLoadingContent::DecrementVisibleCount()
{
NS_ASSERTION(mVisibleCount > 0, "visible count should be positive here");
mVisibleCount--;
if (mVisibleCount == 0) {
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);
}
}
uint32_t
nsImageLoadingContent::GetVisibleCount()
{
return mVisibleCount;
}
/*
* Non-interface methods
*/
@ -1101,7 +1146,7 @@ nsImageLoadingContent::ClearCurrentRequest(nsresult aReason)
&mCurrentRequestRegistered);
// Clean up the request.
UntrackImage(mCurrentRequest);
UntrackImage(mCurrentRequest, REQUEST_DISCARD);
mCurrentRequest->CancelAndForgetObserver(aReason);
mCurrentRequest = nullptr;
mCurrentRequestFlags = 0;
@ -1124,7 +1169,7 @@ nsImageLoadingContent::ClearPendingRequest(nsresult aReason)
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(), mPendingRequest,
&mPendingRequestRegistered);
UntrackImage(mPendingRequest);
UntrackImage(mPendingRequest, REQUEST_DISCARD);
mPendingRequest->CancelAndForgetObserver(aReason);
mPendingRequest = nullptr;
mPendingRequestFlags = 0;
@ -1183,16 +1228,8 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsCxPusher pusher;
pusher.PushNull();
if (GetOurPrimaryFrame()) {
if (mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
aDocument->AddImage(mCurrentRequest);
}
if (mPendingRequest && !(mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags |= REQUEST_IS_TRACKED;
aDocument->AddImage(mPendingRequest);
}
}
TrackImage(mCurrentRequest);
TrackImage(mPendingRequest);
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
aDocument->BlockOnload();
@ -1211,21 +1248,15 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
nsCxPusher pusher;
pusher.PushNull();
if (mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest);
}
if (mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest);
}
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
doc->UnblockOnload(false);
}
nsresult
nsImageLoadingContent::TrackImage(imgIRequest* aImage)
nsImageLoadingContent::TrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0 */)
{
if (!aImage)
return NS_OK;
@ -1234,7 +1265,8 @@ nsImageLoadingContent::TrackImage(imgIRequest* aImage)
"Why haven't we heard of this request?");
nsIDocument* doc = GetOurCurrentDoc();
if (doc && GetOurPrimaryFrame()) {
if (doc && ((aFlags & SKIP_FRAME_CHECK) || GetOurPrimaryFrame()) &&
(mVisibleCount > 0)) {
if (aImage == mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mCurrentRequest);
@ -1248,7 +1280,7 @@ nsImageLoadingContent::TrackImage(imgIRequest* aImage)
}
nsresult
nsImageLoadingContent::UntrackImage(imgIRequest* aImage)
nsImageLoadingContent::UntrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0 */)
{
if (!aImage)
return NS_OK;
@ -1263,11 +1295,13 @@ nsImageLoadingContent::UntrackImage(imgIRequest* aImage)
if (doc) {
if (aImage == mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest, nsIDocument::REQUEST_DISCARD);
doc->RemoveImage(mCurrentRequest,
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
}
if (aImage == mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest, nsIDocument::REQUEST_DISCARD);
doc->RemoveImage(mPendingRequest,
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
}
}
return NS_OK;

View File

@ -183,6 +183,7 @@ protected:
void UnbindFromTree(bool aDeep, bool aNullParent);
nsresult OnStopRequest(imgIRequest* aRequest, nsresult aStatus);
void OnUnlockedDraw();
nsresult OnImageIsAnimated(imgIRequest *aRequest);
private:
@ -326,9 +327,21 @@ protected:
* Adds/Removes a given imgIRequest from our document's tracker.
*
* No-op if aImage is null.
*
* SKIP_FRAME_CHECK passed to TrackImage means we skip the check if we have a
* frame, there is only one valid use of this: when calling from FrameCreated.
*
* REQUEST_DISCARD passed to UntrackImage means we request the discard of the
* decoded data of the image.
*/
nsresult TrackImage(imgIRequest* aImage);
nsresult UntrackImage(imgIRequest* aImage);
enum {
SKIP_FRAME_CHECK = 0x1
};
nsresult TrackImage(imgIRequest* aImage, uint32_t aFlags = 0);
enum {
REQUEST_DISCARD = 0x1
};
nsresult UntrackImage(imgIRequest* aImage, uint32_t aFlags = 0);
/* MEMBERS */
nsRefPtr<imgRequestProxy> mCurrentRequest;
@ -404,6 +417,8 @@ private:
// registered with the refresh driver.
bool mCurrentRequestRegistered;
bool mPendingRequestRegistered;
uint32_t mVisibleCount;
};
#endif // nsImageLoadingContent_h__

View File

@ -1025,7 +1025,8 @@ nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
if (!unicodeDecoder &&
aChannel &&
NS_SUCCEEDED(aChannel->GetContentCharset(charset))) {
NS_SUCCEEDED(aChannel->GetContentCharset(charset)) &&
!charset.IsEmpty()) {
charsetConv->GetUnicodeDecoder(charset.get(),
getter_AddRefs(unicodeDecoder));
}

View File

@ -3371,6 +3371,8 @@ nsXMLHttpRequest::SetMultipart(bool aMultipart, nsresult& aRv)
return;
}
LogMessage("MultipartXHRWarning", GetOwner());
if (aMultipart) {
mState |= XML_HTTP_REQUEST_MULTIPART;
} else {

View File

@ -24,10 +24,8 @@ let am = {
authMgr: null,
init: function() {
const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(Components);
this.authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(Components.interfaces.nsIHttpAuthManager)
this.authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(SpecialPowers.Ci.nsIHttpAuthManager)
},
addIdentity: function() {

View File

@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=425013
<script type="text/javascript;version=1.7">
var missingPlugins = new Array();
var OBJLC = Components.interfaces.nsIObjectLoadingContent;
var OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
function pluginBinding(event)
{

View File

@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429157
<script>
var missingPlugins = new Array();
const OBJLC = Components.interfaces.nsIObjectLoadingContent;
const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
function pluginBindingAttached(event)
{

View File

@ -22,6 +22,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=527896
SimpleTest.waitForExplicitFinish();
SimpleTest.expectAssertions(1);
var docWrittenSrcExecuted = false;
var scriptInsertedSrcExecuted = false;

View File

@ -13,6 +13,8 @@
<iframe style="width:200px;height:200px;" id='cspframe'></iframe>
<script class="testbody" type="text/javascript">
SimpleTest.expectAssertions(1);
// This is used to watch requests go out so we can see if the report is
// sent correctly
function examiner() {

View File

@ -16,6 +16,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=638112
<pre id="test">
<script type="text/javascript">
SimpleTest.expectAssertions(1);
/** Test for Bug 638112 **/
function run_test() {

View File

@ -19,7 +19,7 @@ function test(tag, type) {
"use strict";
info("testing " + tag + " tag with type " + type);
const OBJLC = Components.interfaces.nsIObjectLoadingContent;
const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
let obj = document.createElement(tag);
obj.type = type;
document.body.appendChild(obj);

View File

@ -16,14 +16,12 @@
<pre id="test">
<script class="testbody" type="application/javascript;version=1.8">
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = SpecialPowers.wrap(Components);
const APP_URL = "http://example.org";
const APP_MANIFEST = "http://example.org/manifest.webapp";
const CHILD_PROCESS_SHUTDOWN_MESSAGE = "child-process-shutdown";
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIMessageBroadcaster);
let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(SpecialPowers.Ci.nsIMessageBroadcaster);
/**
* Load the example.org site in an <iframe mozbrowser>

View File

@ -15,18 +15,16 @@
<pre id="test">
<script class="testbody" type="application/javascript;version=1.8">
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = SpecialPowers.wrap(Components);
const APP_URL = "http://example.org";
const APP_MANIFEST = "http://example.org/manifest.webapp";
const CHILD_PROCESS_SHUTDOWN_MESSAGE = "child-process-shutdown";
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIMessageBroadcaster);
let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(Ci.nsISyncMessageSender);
let gAppsService = Cc["@mozilla.org/AppsService;1"]
.getService(Ci.nsIAppsService);
let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(SpecialPowers.Ci.nsIMessageBroadcaster);
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(SpecialPowers.Ci.nsISyncMessageSender);
let gAppsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
.getService(SpecialPowers.Ci.nsIAppsService);
function setUp() {
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);

View File

@ -18,6 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=641821
<pre id="test">
<script type="application/javascript">
if (navigator.platform.indexOf("Win") != 0) {
// for non-Windows
SimpleTest.expectAssertions(1);
}
/** Test for Bug 641821 **/
var div = document.createElement("div");

View File

@ -45,8 +45,8 @@ var OPTIONS = {
SimpleTest.waitForExplicitFinish();
function detectDriverType() {
const Cc = SpecialPowers.wrap(Components).classes;
const Ci = SpecialPowers.wrap(Components).interfaces;
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var doc = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser).parseFromString("<html/>", "text/html");
var canvas = doc.createElement("canvas");
@ -105,15 +105,15 @@ function start() {
if (kIsWindows) {
// code borrowed from browser/modules/test/browser_taskbar_preview.js
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var version = Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2)
var version = SpecialPowers.Cc["@mozilla.org/system-info;1"]
.getService(SpecialPowers.Ci.nsIPropertyBag2)
.getProperty("version");
kIsWindowsVistaOrHigher = (parseFloat(version) >= 6.0);
}
function getEnv(env) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var envsvc = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
var envsvc = SpecialPowers.Cc["@mozilla.org/process/environment;1"].getService(SpecialPowers.Ci.nsIEnvironment);
var val = envsvc.get(env);
if (val == "")
return null;

View File

@ -17,6 +17,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=457672
<pre id="test">
<script type="application/javascript">
SimpleTest.expectAssertions(1);
/** Test for Bug 457672 **/
var windowBlurCount = 0;

View File

@ -5,7 +5,7 @@
#include "mozilla/Util.h"
#include "nsHTMLIFrameElement.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "nsIDOMSVGDocument.h"
#include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h"
@ -14,86 +14,86 @@
#include "nsStyleConsts.h"
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(IFrame)
nsHTMLIFrameElement::nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
DOMCI_NODE_DATA(HTMLIFrameElement, mozilla::dom::HTMLIFrameElement)
namespace mozilla {
namespace dom {
HTMLIFrameElement::HTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
{
}
nsHTMLIFrameElement::~nsHTMLIFrameElement()
HTMLIFrameElement::~HTMLIFrameElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameElement, Element)
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameElement, Element)
NS_IMPL_ADDREF_INHERITED(HTMLIFrameElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLIFrameElement, Element)
DOMCI_NODE_DATA(HTMLIFrameElement, nsHTMLIFrameElement)
// QueryInterface implementation for nsHTMLIFrameElement
NS_INTERFACE_TABLE_HEAD(nsHTMLIFrameElement)
NS_HTML_CONTENT_INTERFACE_TABLE_BEGIN(nsHTMLIFrameElement)
NS_INTERFACE_TABLE_ENTRY(nsHTMLIFrameElement, nsIDOMHTMLIFrameElement)
NS_INTERFACE_TABLE_ENTRY(nsHTMLIFrameElement, nsIDOMGetSVGDocument)
// QueryInterface implementation for HTMLIFrameElement
NS_INTERFACE_TABLE_HEAD(HTMLIFrameElement)
NS_HTML_CONTENT_INTERFACE_TABLE_BEGIN(HTMLIFrameElement)
NS_INTERFACE_TABLE_ENTRY(HTMLIFrameElement, nsIDOMHTMLIFrameElement)
NS_INTERFACE_TABLE_ENTRY(HTMLIFrameElement, nsIDOMGetSVGDocument)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLIFrameElement,
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLIFrameElement,
nsGenericHTMLFrameElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLIFrameElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLIFrameElement)
NS_IMPL_ELEMENT_CLONE(HTMLIFrameElement)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Align, align)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, FrameBorder, frameborder)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Height, height)
NS_IMPL_URI_ATTR(nsHTMLIFrameElement, LongDesc, longdesc)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, MarginHeight, marginheight)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, MarginWidth, marginwidth)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Scrolling, scrolling)
NS_IMPL_URI_ATTR(nsHTMLIFrameElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Width, width)
NS_IMPL_BOOL_ATTR(nsHTMLIFrameElement, Allowfullscreen, allowfullscreen)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Sandbox, sandbox)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Align, align)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, FrameBorder, frameborder)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Height, height)
NS_IMPL_URI_ATTR(HTMLIFrameElement, LongDesc, longdesc)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, MarginHeight, marginheight)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, MarginWidth, marginwidth)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Name, name)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Scrolling, scrolling)
NS_IMPL_URI_ATTR(HTMLIFrameElement, Src, src)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Width, width)
NS_IMPL_BOOL_ATTR(HTMLIFrameElement, AllowFullscreen, allowfullscreen)
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Sandbox, sandbox)
void
nsHTMLIFrameElement::GetItemValueText(nsAString& aValue)
HTMLIFrameElement::GetItemValueText(nsAString& aValue)
{
GetSrc(aValue);
}
void
nsHTMLIFrameElement::SetItemValueText(const nsAString& aValue)
HTMLIFrameElement::SetItemValueText(const nsAString& aValue)
{
SetSrc(aValue);
}
NS_IMETHODIMP
nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
HTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
return nsGenericHTMLFrameElement::GetContentDocument(aContentDocument);
}
NS_IMETHODIMP
nsHTMLIFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
HTMLIFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
{
return nsGenericHTMLFrameElement::GetContentWindow(aContentWindow);
}
NS_IMETHODIMP
nsHTMLIFrameElement::GetSVGDocument(nsIDOMDocument **aResult)
HTMLIFrameElement::GetSVGDocument(nsIDOMDocument **aResult)
{
return GetContentDocument(aResult);
}
bool
nsHTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::marginwidth) {
@ -180,7 +180,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
}
NS_IMETHODIMP_(bool)
nsHTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
HTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::width },
@ -202,15 +202,15 @@ nsHTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
nsMapRuleToAttributesFunc
nsHTMLIFrameElement::GetAttributeMappingFunction() const
HTMLIFrameElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}
nsresult
nsHTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify)
HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify)
{
if (aName == nsGkAtoms::sandbox && aNameSpaceID == kNameSpaceID_None) {
// Parse the new value of the sandbox attribute, and if we have a docshell
@ -237,7 +237,7 @@ nsHTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
uint32_t
nsHTMLIFrameElement::GetSandboxFlags()
HTMLIFrameElement::GetSandboxFlags()
{
nsAutoString sandboxAttr;
@ -248,3 +248,6 @@ nsHTMLIFrameElement::GetSandboxFlags()
// No sandbox attribute, no sandbox flags.
return 0;
}
} // namespace dom
} // namespace mozilla

View File

@ -3,20 +3,26 @@
* 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_dom_HTMLIFrameElement_h
#define mozilla_dom_HTMLIFrameElement_h
#include "nsGenericHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMGetSVGDocument.h"
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement
, public nsIDOMHTMLIFrameElement
, public nsIDOMGetSVGDocument
namespace mozilla {
namespace dom {
class HTMLIFrameElement MOZ_FINAL : public nsGenericHTMLFrameElement
, public nsIDOMHTMLIFrameElement
, public nsIDOMGetSVGDocument
{
public:
nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLIFrameElement();
HTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser = NOT_FROM_PARSER);
virtual ~HTMLIFrameElement();
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLIFrameElement, iframe)
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLIFrameElement, iframe)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -58,3 +64,8 @@ protected:
virtual void GetItemValueText(nsAString& text);
virtual void SetItemValueText(const nsAString& text);
};
} // namespace dom
} // namespace mozilla
#endif

View File

@ -21,7 +21,6 @@ endif # !_MSC_VER
EXPORTS = \
HTMLPropertiesCollection.h \
nsGenericHTMLElement.h \
nsHTMLIFrameElement.h \
nsClientRect.h \
nsHTMLDNSPrefetch.h \
nsTimeRanges.h \
@ -43,6 +42,7 @@ EXPORTS_mozilla/dom = \
HTMLFrameSetElement.h \
HTMLHeadingElement.h \
HTMLHRElement.h \
HTMLIFrameElement.h \
HTMLImageElement.h \
HTMLLabelElement.h \
HTMLLegendElement.h \
@ -103,7 +103,7 @@ CPPSRCS = \
HTMLFrameSetElement.cpp \
HTMLHRElement.cpp \
HTMLHeadingElement.cpp \
nsHTMLIFrameElement.cpp \
HTMLIFrameElement.cpp \
HTMLImageElement.cpp \
nsHTMLInputElement.cpp \
HTMLLIElement.cpp \

View File

@ -2359,6 +2359,9 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
aDecoder->SetAudioChannelType(mAudioChannelType);
aDecoder->SetAudioCaptured(mAudioCaptured);
aDecoder->SetVolume(mMuted ? 0.0 : mVolume);
aDecoder->SetPreservesPitch(mPreservesPitch);
aDecoder->SetPlaybackRate(mPlaybackRate);
for (uint32_t i = 0; i < mOutputStreams.Length(); ++i) {
OutputMediaStream* ms = &mOutputStreams[i];
aDecoder->AddOutputStream(ms->mStream->GetStream()->AsProcessedStream(),
@ -3581,7 +3584,9 @@ NS_IMETHODIMP nsHTMLMediaElement::GetMozPreservesPitch(bool* aPreservesPitch)
NS_IMETHODIMP nsHTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch)
{
mPreservesPitch = aPreservesPitch;
mDecoder->SetPreservesPitch(aPreservesPitch);
if (mDecoder) {
mDecoder->SetPreservesPitch(mPreservesPitch);
}
return NS_OK;
}

View File

@ -255,6 +255,8 @@ MOCHITEST_FILES = \
file_fullscreen-esc-exit-inner.html \
file_fullscreen-rollback.html \
file_fullscreen-svg-element.html \
file_fullscreen-multiple.html \
file_fullscreen-multiple-inner.html \
test_li_attributes_reflection.html \
test_link_attributes_reflection.html \
test_ol_attributes_reflection.html \

View File

@ -78,7 +78,7 @@ function exit1(event) {
is(event.target, document, "10. Event target should be full-screen document #2");
is(document.mozFullScreenElement, null, "11. Full-screen element should be null.");
iframe = document.createElement("iframe");
iframe.allowfullscreen = true;
iframe.allowFullscreen = true;
addFullscreenChangeContinuation("enter", enter2);
document.body.appendChild(iframe);
iframe.src = iframeContents;

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