mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 01:08:21 +00:00
Merge last PGO-green changeset of mozilla-inbound to mozilla-central
This commit is contained in:
commit
1f959a566c
@ -35,47 +35,9 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
||||
AccEvent::AccEvent(uint32_t aEventType, nsINode* aNode,
|
||||
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mNode(aNode)
|
||||
{
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent public methods
|
||||
|
||||
Accessible*
|
||||
AccEvent::GetAccessible()
|
||||
{
|
||||
if (!mAccessible)
|
||||
mAccessible = GetAccessibleForNode();
|
||||
|
||||
return mAccessible;
|
||||
}
|
||||
|
||||
nsINode*
|
||||
AccEvent::GetNode()
|
||||
{
|
||||
if (!mNode && mAccessible)
|
||||
mNode = mAccessible->GetNode();
|
||||
|
||||
return mNode;
|
||||
}
|
||||
|
||||
DocAccessible*
|
||||
AccEvent::GetDocAccessible()
|
||||
{
|
||||
if (mAccessible)
|
||||
return mAccessible->Document();
|
||||
|
||||
nsINode* node = GetNode();
|
||||
if (node)
|
||||
return GetAccService()->GetDocAccessible(node->OwnerDoc());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccEvent::CreateXPCOMObject()
|
||||
{
|
||||
@ -104,56 +66,23 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent protected methods
|
||||
|
||||
Accessible*
|
||||
AccEvent::GetAccessibleForNode() const
|
||||
{
|
||||
if (mNode) {
|
||||
DocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(mNode->OwnerDoc());
|
||||
if (document)
|
||||
return document->GetAccessible(mNode);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsINode *targetNode = GetNode();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!targetNode) {
|
||||
// XXX: remove this hack during reorganization of 506907. Meanwhile we
|
||||
// want to get rid an assertion for application accessible events which
|
||||
// don't have DOM node (see bug 506206).
|
||||
|
||||
if (mAccessible != static_cast<nsIAccessible*>(ApplicationAcc()))
|
||||
NS_ASSERTION(targetNode, "There should always be a DOM node for an event");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aIsFromUserInput != eAutoDetect) {
|
||||
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!targetNode)
|
||||
return;
|
||||
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(targetNode);
|
||||
if (!presShell) {
|
||||
NS_NOTREACHED("Threre should always be an pres shell for an event");
|
||||
DocAccessible* document = mAccessible->Document();
|
||||
if (!document) {
|
||||
NS_ASSERTION(mAccessible == ApplicationAcc(),
|
||||
"Accessible other than application should always have a doc!");
|
||||
return;
|
||||
}
|
||||
|
||||
nsEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
|
||||
if (!esm) {
|
||||
NS_NOTREACHED("There should always be an ESM for an event");
|
||||
return;
|
||||
}
|
||||
|
||||
mIsFromUserInput = esm->IsHandlingUserInputExternal();
|
||||
mIsFromUserInput =
|
||||
document->PresContext()->EventStateManager()->IsHandlingUserInputExternal();
|
||||
}
|
||||
|
||||
|
||||
@ -161,39 +90,6 @@ AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
// AccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't currently
|
||||
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState,
|
||||
bool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState, bool aIsEnabled):
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
||||
eAutoDetect, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
||||
eAutoDetect, eAllowDupes),
|
||||
mState(aState)
|
||||
{
|
||||
// Use GetAccessibleForNode() because we do not want to store an accessible
|
||||
// since it leads to problems with delayed events in the case when
|
||||
// an accessible gets reorder event before delayed event is processed.
|
||||
Accessible* accessible = GetAccessibleForNode();
|
||||
mIsEnabled = accessible && ((accessible->State() & mState) != 0);
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccStateChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
@ -296,20 +192,6 @@ AccShowEvent::
|
||||
// AccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(Accessible* aAccessible, int32_t aCaretOffset) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
|
||||
mCaretOffset(aCaretOffset)
|
||||
{
|
||||
}
|
||||
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(nsINode* aNode) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode),
|
||||
mCaretOffset(-1)
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccCaretMoveEvent::CreateXPCOMObject()
|
||||
{
|
||||
|
@ -38,17 +38,18 @@ public:
|
||||
// Rule for accessible events.
|
||||
// The rule will be applied when flushing pending events.
|
||||
enum EEventRule {
|
||||
// eAllowDupes : More than one event of the same type is allowed.
|
||||
// This event will always be emitted.
|
||||
eAllowDupes,
|
||||
// eAllowDupes : More than one event of the same type is allowed.
|
||||
// This event will always be emitted. This flag is used for events that
|
||||
// don't support coalescence.
|
||||
eAllowDupes,
|
||||
|
||||
// eCoalesceReorder : For reorder events from the same subtree or the same
|
||||
// node, only the umbrella event on the ancestor will be emitted.
|
||||
eCoalesceReorder,
|
||||
eCoalesceReorder,
|
||||
|
||||
// eCoalesceMutationTextChange : coalesce text change events caused by
|
||||
// tree mutations of the same tree level.
|
||||
eCoalesceMutationTextChange,
|
||||
eCoalesceMutationTextChange,
|
||||
|
||||
// eCoalesceOfSameType : For events of the same type, only the newest event
|
||||
// will be processed.
|
||||
@ -59,20 +60,16 @@ public:
|
||||
|
||||
// eRemoveDupes : For repeat events, only the newest event in queue
|
||||
// will be emitted.
|
||||
eRemoveDupes,
|
||||
eRemoveDupes,
|
||||
|
||||
// eDoNotEmit : This event is confirmed as a duplicate, do not emit it.
|
||||
eDoNotEmit
|
||||
eDoNotEmit
|
||||
};
|
||||
|
||||
// Initialize with an nsIAccessible
|
||||
AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
// Initialize with an nsINode
|
||||
AccEvent(uint32_t aEventType, nsINode* aNode,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
virtual ~AccEvent() {}
|
||||
|
||||
// AccEvent
|
||||
@ -80,9 +77,8 @@ public:
|
||||
EEventRule GetEventRule() const { return mEventRule; }
|
||||
bool IsFromUserInput() const { return mIsFromUserInput; }
|
||||
|
||||
Accessible* GetAccessible();
|
||||
DocAccessible* GetDocAccessible();
|
||||
nsINode* GetNode();
|
||||
Accessible* GetAccessible() const { return mAccessible; }
|
||||
DocAccessible* GetDocAccessible() const { return mAccessible->Document(); }
|
||||
|
||||
/**
|
||||
* Create and return an XPCOM object for accessible event object.
|
||||
@ -119,10 +115,6 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get an accessible from event target node.
|
||||
*/
|
||||
Accessible* GetAccessibleForNode() const;
|
||||
|
||||
/**
|
||||
* Determine whether the event is from user input by event state manager if
|
||||
@ -134,7 +126,6 @@ protected:
|
||||
uint32_t mEventType;
|
||||
EEventRule mEventRule;
|
||||
nsRefPtr<Accessible> mAccessible;
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
|
||||
friend class NotificationController;
|
||||
friend class AccReorderEvent;
|
||||
@ -149,11 +140,15 @@ class AccStateChangeEvent: public AccEvent
|
||||
public:
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState,
|
||||
bool aIsEnabled,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect) :
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled) { }
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState, bool aIsEnabled);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, uint64_t aState);
|
||||
AccStateChangeEvent(Accessible* aAccessible, uint64_t aState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
eAutoDetect, eAllowDupes), mState(aState)
|
||||
{ mIsEnabled = (mAccessible->State() & mState) != 0; }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
@ -239,6 +234,7 @@ public:
|
||||
bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; }
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
nsRefPtr<Accessible> mParent;
|
||||
nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
|
||||
|
||||
@ -350,8 +346,10 @@ protected:
|
||||
class AccCaretMoveEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
AccCaretMoveEvent(Accessible* aAccessible, int32_t aCaretOffset);
|
||||
AccCaretMoveEvent(nsINode* aNode);
|
||||
AccCaretMoveEvent(Accessible* aAccessible) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
|
||||
mCaretOffset(-1) { }
|
||||
virtual ~AccCaretMoveEvent() { }
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
@ -367,6 +365,8 @@ public:
|
||||
|
||||
private:
|
||||
int32_t mCaretOffset;
|
||||
|
||||
friend class NotificationController;
|
||||
};
|
||||
|
||||
|
||||
|
@ -219,7 +219,7 @@ FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
|
||||
eAutoDetect, AccEvent::eCoalesceOfSameType);
|
||||
aDocument->FireDelayedAccessibleEvent(event);
|
||||
aDocument->FireDelayedEvent(event);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
|
@ -471,12 +471,9 @@ logging::DocLoadEventHandled(AccEvent* aEvent)
|
||||
|
||||
MsgBegin(sDocEventTitle, "handled '%s' event", strEventType.get());
|
||||
|
||||
nsINode* node = aEvent->GetNode();
|
||||
if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
|
||||
nsIDocument* documentNode = static_cast<nsIDocument*>(node);
|
||||
DocAccessible* document = aEvent->GetDocAccessible();
|
||||
LogDocInfo(documentNode, document);
|
||||
}
|
||||
DocAccessible* document = aEvent->GetAccessible()->AsDoc();
|
||||
if (document)
|
||||
LogDocInfo(document->DocumentNode(), document);
|
||||
|
||||
MsgEnd();
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ NotificationController::CoalesceEvents()
|
||||
AccEvent* accEvent = mEvents[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule &&
|
||||
accEvent->mNode == tailEvent->mNode) {
|
||||
accEvent->mAccessible == tailEvent->mAccessible) {
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
@ -705,12 +705,11 @@ NotificationController::ProcessEventQueue()
|
||||
|
||||
// Dispatch caret moved and text selection change events.
|
||||
if (event->mEventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
|
||||
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(event);
|
||||
HyperTextAccessible* hyperText = target->AsHyperText();
|
||||
int32_t caretOffset = -1;
|
||||
if (hyperText &&
|
||||
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretOffset))) {
|
||||
nsRefPtr<AccEvent> caretMoveEvent =
|
||||
new AccCaretMoveEvent(hyperText, caretOffset);
|
||||
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretMoveEvent->mCaretOffset))) {
|
||||
|
||||
nsEventShell::FireEvent(caretMoveEvent);
|
||||
|
||||
// There's a selection so fire selection change as well.
|
||||
|
@ -78,7 +78,7 @@ private:
|
||||
|
||||
Class* mInstance;
|
||||
Callback mCallback;
|
||||
nsCOMPtr<Arg> mArg;
|
||||
nsRefPtr<Arg> mArg;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -82,14 +82,14 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
|
||||
// Fire text change event for removal.
|
||||
nsRefPtr<AccEvent> textRemoveEvent =
|
||||
new AccTextChangeEvent(mHyperText, mTextOffset, str1, false);
|
||||
mDocument->FireDelayedAccessibleEvent(textRemoveEvent);
|
||||
mDocument->FireDelayedEvent(textRemoveEvent);
|
||||
}
|
||||
|
||||
if (strLen2 > 0) {
|
||||
// Fire text change event for insertion.
|
||||
nsRefPtr<AccEvent> textInsertEvent =
|
||||
new AccTextChangeEvent(mHyperText, mTextOffset, str2, true);
|
||||
mDocument->FireDelayedAccessibleEvent(textInsertEvent);
|
||||
mDocument->FireDelayedEvent(textInsertEvent);
|
||||
}
|
||||
|
||||
mDocument->MaybeNotifyOfValueChange(mHyperText);
|
||||
@ -135,7 +135,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
|
||||
|
||||
// Fire events.
|
||||
for (int32_t idx = events.Length() - 1; idx >= 0; idx--)
|
||||
mDocument->FireDelayedAccessibleEvent(events[idx]);
|
||||
mDocument->FireDelayedEvent(events[idx]);
|
||||
|
||||
mDocument->MaybeNotifyOfValueChange(mHyperText);
|
||||
|
||||
|
@ -400,9 +400,8 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||
// the same document.
|
||||
// Note: don't use AccReorderEvent to avoid coalsecense and special reorder
|
||||
// events processing.
|
||||
nsRefPtr<AccEvent> reorderEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, ApplicationAcc());
|
||||
docAcc->FireDelayedAccessibleEvent(reorderEvent);
|
||||
docAcc->FireDelayedEvent(nsIAccessibleEvent::EVENT_REORDER,
|
||||
ApplicationAcc());
|
||||
|
||||
} else {
|
||||
parentDocAcc->BindChildDocument(docAcc);
|
||||
|
@ -243,10 +243,8 @@ nsCaretAccessible::NormalSelectionChanged(nsISelection* aSelection)
|
||||
mLastCaretOffset = caretOffset;
|
||||
mLastTextAccessible = textAcc;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccCaretMoveEvent(mLastTextAccessible->GetNode());
|
||||
if (event)
|
||||
mLastTextAccessible->Document()->FireDelayedAccessibleEvent(event);
|
||||
nsRefPtr<AccEvent> event = new AccCaretMoveEvent(mLastTextAccessible);
|
||||
mLastTextAccessible->Document()->FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
@ -258,15 +256,13 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsISelection* aSelection)
|
||||
// misspelled word). If spellchecking is disabled (for example,
|
||||
// @spellcheck="false" on html:body) then we won't fire any event.
|
||||
|
||||
HyperTextAccessible* textAcc =
|
||||
HyperTextAccessible* hyperText =
|
||||
nsAccUtils::GetTextAccessibleFromSelection(aSelection);
|
||||
if (!textAcc)
|
||||
return;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED, textAcc);
|
||||
if (event)
|
||||
textAcc->Document()->FireDelayedAccessibleEvent(event);
|
||||
if (hyperText) {
|
||||
hyperText->Document()->
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
|
||||
hyperText);
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
|
@ -22,7 +22,7 @@ nsEventShell::FireEvent(AccEvent* aEvent)
|
||||
Accessible* accessible = aEvent->GetAccessible();
|
||||
NS_ENSURE_TRUE_VOID(accessible);
|
||||
|
||||
nsINode* node = aEvent->GetNode();
|
||||
nsINode* node = accessible->GetNode();
|
||||
if (node) {
|
||||
sEventTargetNode = node;
|
||||
sEventFromUserInput = aEvent->IsFromUserInput();
|
||||
|
@ -12,9 +12,31 @@
|
||||
#include "NotificationController.h"
|
||||
#include "States.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline void
|
||||
DocAccessible::FireDelayedEvent(AccEvent* aEvent)
|
||||
{
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
logging::DocLoadEventFired(aEvent);
|
||||
#endif
|
||||
|
||||
mNotificationController->QueueEvent(aEvent);
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::FireDelayedEvent(uint32_t aEventType, Accessible* aTarget)
|
||||
{
|
||||
nsRefPtr<AccEvent> event = new AccEvent(aEventType, aTarget);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::BindChildDocument(DocAccessible* aDocument)
|
||||
{
|
||||
@ -54,20 +76,16 @@ DocAccessible::NotifyOfLoad(uint32_t aLoadEventType)
|
||||
if (HasLoadState(eCompletelyLoaded) && IsLoadEventTarget()) {
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(this, states::BUSY, false);
|
||||
FireDelayedAccessibleEvent(stateEvent);
|
||||
FireDelayedEvent(stateEvent);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
|
||||
{
|
||||
mozilla::a11y::role role = aAccessible->Role();
|
||||
if (role == roles::ENTRY || role == roles::COMBOBOX) {
|
||||
nsRefPtr<AccEvent> valueChangeEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
eAutoDetect, AccEvent::eRemoveDupes);
|
||||
FireDelayedAccessibleEvent(valueChangeEvent);
|
||||
}
|
||||
a11y::role role = aAccessible->Role();
|
||||
if (role == roles::ENTRY || role == roles::COMBOBOX)
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -44,10 +44,6 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
@ -892,7 +888,7 @@ DocAccessible::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
// about this exceptional case.
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(this, states::EDITABLE, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -987,7 +983,7 @@ DocAccessible::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// Fire accessible events iff there's an accessible, otherwise we consider
|
||||
// the accessible state wasn't changed, i.e. its state is initial state.
|
||||
AttributeChangedImpl(aElement, aNameSpaceID, aAttribute);
|
||||
AttributeChangedImpl(accessible, aNameSpaceID, aAttribute);
|
||||
|
||||
// Update dependent IDs cache. Take care of accessible elements because no
|
||||
// accessible element means either the element is not accessible at all or
|
||||
@ -1002,7 +998,8 @@ DocAccessible::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// DocAccessible protected member
|
||||
void
|
||||
DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID, nsIAtom* aAttribute)
|
||||
DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute)
|
||||
{
|
||||
// Fire accessible event after short timer, because we need to wait for
|
||||
// DOM attribute & resulting layout to actually change. Otherwise,
|
||||
@ -1033,14 +1030,12 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
|
||||
nsRefPtr<AccEvent> enabledChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::ENABLED);
|
||||
|
||||
FireDelayedAccessibleEvent(enabledChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::ENABLED);
|
||||
FireDelayedEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<AccEvent> sensitiveChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::SENSITIVE);
|
||||
|
||||
FireDelayedAccessibleEvent(sensitiveChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::SENSITIVE);
|
||||
FireDelayedEvent(sensitiveChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1049,7 +1044,7 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
// Check for hyphenated aria-foo property?
|
||||
if (StringBeginsWith(nsDependentAtomString(aAttribute),
|
||||
NS_LITERAL_STRING("aria-"))) {
|
||||
ARIAAttributeChanged(aContent, aAttribute);
|
||||
ARIAAttributeChanged(aAccessible, aAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1057,75 +1052,69 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
aAttribute == nsGkAtoms::title ||
|
||||
aAttribute == nsGkAtoms::aria_label ||
|
||||
aAttribute == nsGkAtoms::aria_labelledby) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE,
|
||||
aContent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, aAccessible);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_busy) {
|
||||
bool isOn = aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aContent, states::BUSY, isOn);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
bool isOn = aAccessible->GetContent()->
|
||||
AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aAccessible, states::BUSY, isOn);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// ARIA or XUL selection
|
||||
if ((aContent->IsXUL() && aAttribute == nsGkAtoms::selected) ||
|
||||
if ((aAccessible->GetContent()->IsXUL() && aAttribute == nsGkAtoms::selected) ||
|
||||
aAttribute == nsGkAtoms::aria_selected) {
|
||||
Accessible* item = GetAccessible(aContent);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
Accessible* widget =
|
||||
nsAccUtils::GetSelectableContainer(item, item->State());
|
||||
nsAccUtils::GetSelectableContainer(aAccessible, aAccessible->State());
|
||||
if (widget) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
nsGkAtoms::_true, eCaseMatters) ?
|
||||
elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccSelChangeEvent(widget, item, selChangeType);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccSelChangeEvent(widget, aAccessible, selChangeType);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::contenteditable) {
|
||||
nsRefPtr<AccEvent> editableChangeEvent =
|
||||
new AccStateChangeEvent(aContent, states::EDITABLE);
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
new AccStateChangeEvent(aAccessible, states::EDITABLE);
|
||||
FireDelayedEvent(editableChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::value) {
|
||||
Accessible* accessible = GetAccessible(aContent);
|
||||
if(accessible && accessible->IsProgress()) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
aContent);
|
||||
}
|
||||
if (aAccessible->IsProgress())
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
}
|
||||
}
|
||||
|
||||
// DocAccessible protected member
|
||||
void
|
||||
DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute)
|
||||
{
|
||||
// Note: For universal/global ARIA states and properties we don't care if
|
||||
// there is an ARIA role present or not.
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_required) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::REQUIRED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::REQUIRED);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_invalid) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::INVALID);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::INVALID);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1133,8 +1122,8 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// to the element with the id that activedescendant points to. Make sure
|
||||
// the tree up to date before processing.
|
||||
if (aAttribute == nsGkAtoms::aria_activedescendant) {
|
||||
mNotificationController->HandleNotification<DocAccessible, nsIContent>
|
||||
(this, &DocAccessible::ARIAActiveDescendantChanged, aContent);
|
||||
mNotificationController->HandleNotification<DocAccessible, Accessible>
|
||||
(this, &DocAccessible::ARIAActiveDescendantChanged, aAccessible);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1142,8 +1131,8 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// We treat aria-expanded as a global ARIA state for historical reasons
|
||||
if (aAttribute == nsGkAtoms::aria_expanded) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::EXPANDED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::EXPANDED);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1151,10 +1140,11 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// change event; at least until native API comes up with a more meaningful event.
|
||||
uint8_t attrFlags = nsAccUtils::GetAttributeCharacteristics(aAttribute);
|
||||
if (!(attrFlags & ATTR_BYPASSOBJ))
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aContent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aAccessible);
|
||||
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
if (!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
// We don't care about these other ARIA attribute changes unless there is
|
||||
// an ARIA role set for the element
|
||||
// XXX: we should check the role map to see if the changed property is
|
||||
@ -1165,29 +1155,26 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// The following ARIA attributes only take affect when dynamic content role is present
|
||||
if (aAttribute == nsGkAtoms::aria_checked ||
|
||||
aAttribute == nsGkAtoms::aria_pressed) {
|
||||
const uint32_t kState = (aAttribute == nsGkAtoms::aria_checked) ?
|
||||
const uint64_t kState = (aAttribute == nsGkAtoms::aria_checked) ?
|
||||
states::CHECKED : states::PRESSED;
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aContent, kState);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aAccessible, kState);
|
||||
FireDelayedEvent(event);
|
||||
|
||||
Accessible* accessible = event->GetAccessible();
|
||||
if (accessible) {
|
||||
bool wasMixed = (mARIAAttrOldValue == nsGkAtoms::mixed);
|
||||
bool isMixed = aContent->AttrValueIs(kNameSpaceID_None, aAttribute,
|
||||
nsGkAtoms::mixed, eCaseMatters);
|
||||
if (isMixed != wasMixed) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::MIXED, isMixed);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
bool wasMixed = (mARIAAttrOldValue == nsGkAtoms::mixed);
|
||||
bool isMixed = elm->AttrValueIs(kNameSpaceID_None, aAttribute,
|
||||
nsGkAtoms::mixed, eCaseMatters);
|
||||
if (isMixed != wasMixed) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aAccessible, states::MIXED, isMixed);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_readonly) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::READONLY);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(aAccessible, states::READONLY);
|
||||
FireDelayedEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1195,23 +1182,22 @@ DocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// when aria-valuenow is changed and aria-valuetext is empty
|
||||
if (aAttribute == nsGkAtoms::aria_valuetext ||
|
||||
(aAttribute == nsGkAtoms::aria_valuenow &&
|
||||
(!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
|
||||
nsGkAtoms::_empty, eCaseMatters)))) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
aContent);
|
||||
(!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext) ||
|
||||
elm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_valuetext,
|
||||
nsGkAtoms::_empty, eCaseMatters)))) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
|
||||
DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
|
||||
{
|
||||
Accessible* widget = GetAccessible(aElm);
|
||||
if (widget && widget->IsActiveWidget()) {
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
if (elm && aAccessible->IsActiveWidget()) {
|
||||
nsAutoString id;
|
||||
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
dom::Element* activeDescendantElm = aElm->OwnerDoc()->GetElementById(id);
|
||||
if (elm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
dom::Element* activeDescendantElm = elm->OwnerDoc()->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
Accessible* activeDescendant = GetAccessible(activeDescendantElm);
|
||||
if (activeDescendant) {
|
||||
@ -1240,31 +1226,32 @@ DocAccessible::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
nsEventStates aStateMask)
|
||||
{
|
||||
Accessible* accessible = GetAccessible(aContent);
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
|
||||
Accessible* item = GetAccessible(aContent);
|
||||
if (item) {
|
||||
Accessible* widget = item->ContainerWidget();
|
||||
if (widget && widget->IsSelect()) {
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
nsRefPtr<AccEvent> event = new AccSelChangeEvent(widget, item,
|
||||
selChangeType);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
Accessible* widget = accessible->ContainerWidget();
|
||||
if (widget && widget->IsSelect()) {
|
||||
AccSelChangeEvent::SelChangeType selChangeType =
|
||||
aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED) ?
|
||||
AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccSelChangeEvent(widget, accessible, selChangeType);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::INVALID, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(accessible, states::INVALID, true);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, states::TRAVERSED, true);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
new AccStateChangeEvent(accessible, states::TRAVERSED, true);
|
||||
FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1542,8 +1529,8 @@ DocAccessible::NotifyOfLoading(bool aIsReloading)
|
||||
// Fire state busy change event. Use delayed event since we don't care
|
||||
// actually if event isn't delivered when the document goes away like a shot.
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(mDocument, states::BUSY, true);
|
||||
FireDelayedAccessibleEvent(stateEvent);
|
||||
new AccStateChangeEvent(this, states::BUSY, true);
|
||||
FireDelayedEvent(stateEvent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1567,7 +1554,7 @@ DocAccessible::DoInitialUpdate()
|
||||
// a problem then consider to keep event processing per tab document.
|
||||
if (!IsRoot()) {
|
||||
nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
|
||||
ParentDocument()->FireDelayedAccessibleEvent(reorderEvent);
|
||||
ParentDocument()->FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1747,36 +1734,6 @@ DocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
|
||||
return false;
|
||||
}
|
||||
|
||||
// DocAccessible public member
|
||||
nsresult
|
||||
DocAccessible::FireDelayedAccessibleEvent(uint32_t aEventType, nsINode* aNode,
|
||||
AccEvent::EEventRule aAllowDupes,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(aEventType, aNode, aIsFromUserInput, aAllowDupes);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
// DocAccessible public member
|
||||
nsresult
|
||||
DocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
logging::DocLoadEventFired(aEvent);
|
||||
#endif
|
||||
|
||||
if (mNotificationController)
|
||||
mNotificationController->QueueEvent(aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessible::ProcessContentInserted(Accessible* aContainer,
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* aInsertedContent)
|
||||
@ -1874,9 +1831,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
Accessible* ancestor = aContainer;
|
||||
while (ancestor) {
|
||||
if (ancestor->ARIARole() == roles::ALERT) {
|
||||
nsRefPtr<AccEvent> alertEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
FireDelayedAccessibleEvent(alertEvent);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1892,7 +1847,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
|
||||
// Fire reorder event so the MSAA clients know the children have changed. Also
|
||||
// the event is used internally by MSAA layer.
|
||||
FireDelayedAccessibleEvent(reorderEvent);
|
||||
FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@ -1916,11 +1871,8 @@ DocAccessible::UpdateTreeInternal(Accessible* aChild, bool aIsInsert,
|
||||
// the changes before our processing and we may miss some menupopup
|
||||
// events. Now we just want to be consistent in content insertion/removal
|
||||
// handling.
|
||||
if (aChild->ARIARole() == roles::MENUPOPUP) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
if (aChild->ARIARole() == roles::MENUPOPUP)
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
|
||||
}
|
||||
|
||||
// Fire show/hide event.
|
||||
@ -1930,23 +1882,19 @@ DocAccessible::UpdateTreeInternal(Accessible* aChild, bool aIsInsert,
|
||||
else
|
||||
event = new AccHideEvent(aChild, node);
|
||||
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(event);
|
||||
aReorderEvent->AddSubMutationEvent(event);
|
||||
|
||||
if (aIsInsert) {
|
||||
roles::Role ariaRole = aChild->ARIARole();
|
||||
if (ariaRole == roles::MENUPOPUP) {
|
||||
// Fire EVENT_MENUPOPUP_START if ARIA menu appears.
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START, aChild);
|
||||
|
||||
} else if (ariaRole == roles::ALERT) {
|
||||
// Fire EVENT_ALERT if ARIA alert appears.
|
||||
updateFlags = eAlertAccessible;
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_ALERT, aChild);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, aChild);
|
||||
}
|
||||
|
||||
// If focused node has been shown then it means its frame was recreated
|
||||
@ -1996,8 +1944,7 @@ DocAccessible::CacheChildrenInSubtree(Accessible* aRoot)
|
||||
if (aRoot->HasARIARole() && !aRoot->IsDoc()) {
|
||||
a11y::role role = aRoot->ARIARole();
|
||||
if (role == roles::DIALOG || role == roles::DOCUMENT)
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE,
|
||||
aRoot->GetContent());
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE, aRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,22 +173,10 @@ public:
|
||||
{ return mChildDocuments.SafeElementAt(aIndex, nullptr); }
|
||||
|
||||
/**
|
||||
* Non-virtual method to fire a delayed event after a 0 length timeout.
|
||||
*
|
||||
* @param aEventType [in] the nsIAccessibleEvent event type
|
||||
* @param aDOMNode [in] DOM node the accesible event should be fired for
|
||||
* @param aAllowDupes [in] rule to process an event (see EEventRule constants)
|
||||
* Fire accessible event asynchronously.
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(uint32_t aEventType, nsINode *aNode,
|
||||
AccEvent::EEventRule aAllowDupes = AccEvent::eRemoveDupes,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
/**
|
||||
* Fire accessible event after timeout.
|
||||
*
|
||||
* @param aEvent [in] the event to fire
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
|
||||
void FireDelayedEvent(AccEvent* aEvent);
|
||||
void FireDelayedEvent(uint32_t aEventType, Accessible* aTarget);
|
||||
|
||||
/**
|
||||
* Fire value change event on the given accessible if applicable.
|
||||
@ -398,27 +386,28 @@ protected:
|
||||
bool UpdateAccessibleOnAttrChange(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Fires accessible events when attribute is changed.
|
||||
*
|
||||
* @param aContent - node that attribute is changed for
|
||||
* @param aNameSpaceID - namespace of changed attribute
|
||||
* @param aAttribute - changed attribute
|
||||
*/
|
||||
void AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID, nsIAtom* aAttribute);
|
||||
/**
|
||||
* Fire accessible events when attribute is changed.
|
||||
*
|
||||
* @param aAccessible [in] accessible the DOM attribute is changed for
|
||||
* @param aNameSpaceID [in] namespace of changed attribute
|
||||
* @param aAttribute [in] changed attribute
|
||||
*/
|
||||
void AttributeChangedImpl(Accessible* aAccessible,
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Fires accessible events when ARIA attribute is changed.
|
||||
*
|
||||
* @param aContent - node that attribute is changed for
|
||||
* @param aAttribute - changed attribute
|
||||
*/
|
||||
void ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute);
|
||||
/**
|
||||
* Fire accessible events when ARIA attribute is changed.
|
||||
*
|
||||
* @param aAccessible [in] accesislbe the DOM attribute is changed for
|
||||
* @param aAttribute [in] changed attribute
|
||||
*/
|
||||
void ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Process ARIA active-descendant attribute change.
|
||||
*/
|
||||
void ARIAActiveDescendantChanged(nsIContent* aElm);
|
||||
void ARIAActiveDescendantChanged(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Update the accessible tree for inserted content.
|
||||
|
@ -311,8 +311,6 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
XULTreeAccessible* treeAcc = accessible->AsXULTree();
|
||||
if (treeAcc) {
|
||||
@ -383,6 +381,7 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
return;
|
||||
}
|
||||
|
||||
nsINode* targetNode = accessible->GetNode();
|
||||
if (treeItemAcc && eventType.EqualsLiteral("select")) {
|
||||
// XXX: We shouldn't be based on DOM select event which doesn't provide us
|
||||
// any context info. We should integrate into nsTreeSelection instead.
|
||||
@ -478,10 +477,10 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
|
||||
//We don't process 'ValueChange' events for progress meters since we listen
|
||||
//@value attribute change for them.
|
||||
if (!accessible->IsProgress())
|
||||
targetDocument->
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode);
|
||||
if (!accessible->IsProgress()) {
|
||||
targetDocument->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
accessible);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_DRAGDROPSTART
|
||||
else if (eventType.EqualsLiteral("mouseover")) {
|
||||
@ -677,7 +676,7 @@ RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
|
||||
if (notifyOf & kNotifyOfState) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(widget, states::EXPANDED, false);
|
||||
document->FireDelayedAccessibleEvent(event);
|
||||
document->FireDelayedEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "Role.h"
|
||||
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
@ -95,7 +95,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
if (aDoFireEvents) {
|
||||
nsRefPtr<AccHideEvent> event = new AccHideEvent(area, area->GetContent());
|
||||
mDoc->FireDelayedAccessibleEvent(event);
|
||||
mDoc->FireDelayedEvent(event);
|
||||
reorderEvent->AddSubMutationEvent(event);
|
||||
doReorderEvent = true;
|
||||
}
|
||||
@ -121,7 +121,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
if (aDoFireEvents) {
|
||||
nsRefPtr<AccShowEvent> event = new AccShowEvent(area, areaContent);
|
||||
mDoc->FireDelayedAccessibleEvent(event);
|
||||
mDoc->FireDelayedEvent(event);
|
||||
reorderEvent->AddSubMutationEvent(event);
|
||||
doReorderEvent = true;
|
||||
}
|
||||
@ -130,7 +130,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
|
||||
|
||||
// Fire reorder event if needed.
|
||||
if (doReorderEvent)
|
||||
mDoc->FireDelayedAccessibleEvent(reorderEvent);
|
||||
mDoc->FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -45,7 +45,7 @@ nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nullptr;
|
||||
|
||||
nsINode* node = mEvent->GetNode();
|
||||
nsINode* node = mEvent->GetAccessible()->GetNode();
|
||||
if (node)
|
||||
CallQueryInterface(node, aDOMNode);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "XULTreeAccessible.h"
|
||||
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
@ -663,7 +664,7 @@ XULTreeAccessible::TreeViewChanged(nsITreeView* aView)
|
||||
// show/hide events on tree items because it can be expensive to fire them for
|
||||
// each tree item.
|
||||
nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
|
||||
Document()->FireDelayedAccessibleEvent(reorderEvent);
|
||||
Document()->FireDelayedEvent(reorderEvent);
|
||||
|
||||
// Clear cache.
|
||||
ClearCache(mAccessibleCache);
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
if (!MAC) { // Mac failure is bug 541093
|
||||
var checker =
|
||||
new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "false", noTargetId);
|
||||
new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId);
|
||||
gQueue.push(new synthHomeKey(id, checker));
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,10 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
char exePath[MAXPATHLEN];
|
||||
|
||||
#if defined(MOZ_X11)
|
||||
putenv("MOZ_USE_OMTC=1");
|
||||
#endif
|
||||
|
||||
nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't calculate the application directory.\n");
|
||||
|
@ -60,7 +60,9 @@ function ContentPermissionPrompt() {}
|
||||
ContentPermissionPrompt.prototype = {
|
||||
|
||||
handleExistingPermission: function handleExistingPermission(request) {
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, request.type);
|
||||
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
|
||||
request.type;
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, access);
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
return true;
|
||||
@ -83,6 +85,9 @@ ContentPermissionPrompt.prototype = {
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
|
||||
request.type;
|
||||
|
||||
let requestId = this._id++;
|
||||
content.addEventListener("mozContentEvent", function contentEvent(evt) {
|
||||
if (evt.detail.id != requestId)
|
||||
@ -92,8 +97,6 @@ ContentPermissionPrompt.prototype = {
|
||||
if (evt.detail.type == "permission-allow") {
|
||||
if (evt.detail.remember) {
|
||||
rememberPermission(request.type, request.principal);
|
||||
Services.perms.addFromPrincipal(request.principal, request.type,
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
|
||||
request.allow();
|
||||
@ -101,7 +104,7 @@ ContentPermissionPrompt.prototype = {
|
||||
}
|
||||
|
||||
if (evt.detail.remember) {
|
||||
Services.perms.addFromPrincipal(request.principal, request.type,
|
||||
Services.perms.addFromPrincipal(request.principal, access,
|
||||
Ci.nsIPermissionManager.DENY_ACTION);
|
||||
}
|
||||
|
||||
@ -120,7 +123,7 @@ ContentPermissionPrompt.prototype = {
|
||||
remember: request.remember
|
||||
};
|
||||
|
||||
this._permission = request.type;
|
||||
this._permission = access;
|
||||
this._uri = request.principal.URI.spec;
|
||||
this._origin = request.principal.origin;
|
||||
|
||||
|
@ -508,12 +508,13 @@
|
||||
<menu id="menu_socialAmbientMenu">
|
||||
<menupopup id="menu_social-statusarea-popup">
|
||||
<menuitem class="social-statusarea-user menuitem-iconic" pack="start" align="center"
|
||||
observes="socialBroadcaster_userDetails"
|
||||
oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
|
||||
<image class="social-statusarea-user-portrait"
|
||||
observes="socialBroadcaster_userPortrait"/>
|
||||
observes="socialBroadcaster_userDetails"/>
|
||||
<vbox>
|
||||
<label class="social-statusarea-loggedInStatus"
|
||||
observes="socialBroadcaster_loggedInStatus"/>
|
||||
observes="socialBroadcaster_userDetails"/>
|
||||
</vbox>
|
||||
</menuitem>
|
||||
#ifndef XP_WIN
|
||||
|
@ -252,8 +252,7 @@
|
||||
oncommand="openUILinkIn('https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/', 'tab');"/>
|
||||
|
||||
<!-- SocialAPI broadcasters -->
|
||||
<broadcaster id="socialBroadcaster_userPortrait"/>
|
||||
<broadcaster id="socialBroadcaster_loggedInStatus"
|
||||
<broadcaster id="socialBroadcaster_userDetails"
|
||||
notLoggedInLabel="&social.notLoggedIn.label;"/>
|
||||
</broadcasterset>
|
||||
|
||||
|
@ -254,10 +254,7 @@ let SocialChatBar = {
|
||||
}
|
||||
},
|
||||
focus: function SocialChatBar_focus() {
|
||||
if (!this.chatbar.selectedChat)
|
||||
return;
|
||||
let commandDispatcher = gBrowser.ownerDocument.commandDispatcher;
|
||||
commandDispatcher.advanceFocusIntoSubtree(this.chatbar.selectedChat);
|
||||
this.chatbar.focus();
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,12 +670,19 @@ var SocialToolbar = {
|
||||
// social:profile-changed
|
||||
let profile = Social.provider.profile || {};
|
||||
let userPortrait = profile.portrait || "chrome://global/skin/icons/information-32.png";
|
||||
document.getElementById("socialBroadcaster_userPortrait").setAttribute("src", userPortrait);
|
||||
|
||||
let loggedInStatusBroadcaster = document.getElementById("socialBroadcaster_loggedInStatus");
|
||||
let notLoggedInString = loggedInStatusBroadcaster.getAttribute("notLoggedInLabel");
|
||||
let loggedInStatusValue = profile.userName ? profile.userName : notLoggedInString;
|
||||
loggedInStatusBroadcaster.setAttribute("value", loggedInStatusValue);
|
||||
let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
|
||||
let loggedInStatusValue = profile.userName ?
|
||||
profile.userName :
|
||||
userDetailsBroadcaster.getAttribute("notLoggedInLabel");;
|
||||
|
||||
// "image" and "label" are used by Mac's native menus that do not render the menuitem's children
|
||||
// elements. "src" and "value" are used by the image/label children on the other platforms.
|
||||
userDetailsBroadcaster.setAttribute("src", userPortrait);
|
||||
userDetailsBroadcaster.setAttribute("image", userPortrait);
|
||||
|
||||
userDetailsBroadcaster.setAttribute("value", loggedInStatusValue);
|
||||
userDetailsBroadcaster.setAttribute("label", loggedInStatusValue);
|
||||
},
|
||||
|
||||
updateButton: function SocialToolbar_updateButton() {
|
||||
|
@ -668,12 +668,13 @@
|
||||
type="menu">
|
||||
<menupopup id="social-statusarea-popup">
|
||||
<menuitem class="social-statusarea-user menuitem-iconic" pack="start" align="center"
|
||||
observes="socialBroadcaster_userDetails"
|
||||
oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
|
||||
<image class="social-statusarea-user-portrait"
|
||||
observes="socialBroadcaster_userPortrait"/>
|
||||
observes="socialBroadcaster_userDetails"/>
|
||||
<vbox>
|
||||
<label class="social-statusarea-loggedInStatus"
|
||||
observes="socialBroadcaster_loggedInStatus"/>
|
||||
observes="socialBroadcaster_userDetails"/>
|
||||
</vbox>
|
||||
</menuitem>
|
||||
#ifndef XP_WIN
|
||||
|
@ -27,13 +27,20 @@
|
||||
<getter>
|
||||
return this.getAttribute("minimized") == "true";
|
||||
</getter>
|
||||
<setter>
|
||||
<setter><![CDATA[
|
||||
this.isActive = !val;
|
||||
if (val)
|
||||
let parent = this.parentNode;
|
||||
if (val) {
|
||||
this.setAttribute("minimized", "true");
|
||||
else
|
||||
// If this chat is the selected one a new one needs to be selected.
|
||||
if (parent.selectedChat == this)
|
||||
parent._selectAnotherChat();
|
||||
} else {
|
||||
this.removeAttribute("minimized");
|
||||
</setter>
|
||||
// this chat gets selected.
|
||||
parent.selectedChat = this;
|
||||
}
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="isActive">
|
||||
@ -123,6 +130,15 @@
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "nub");
|
||||
</field>
|
||||
|
||||
<method name="focus">
|
||||
<body><![CDATA[
|
||||
if (!this.selectedChat)
|
||||
return;
|
||||
let commandDispatcher = gBrowser.ownerDocument.commandDispatcher;
|
||||
commandDispatcher.advanceFocusIntoSubtree(this.selectedChat);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="selectedChat">
|
||||
<getter><![CDATA[
|
||||
return this._selectedChat;
|
||||
@ -141,6 +157,7 @@
|
||||
this._selectedChat = val;
|
||||
if (val) {
|
||||
this._selectedChat.setAttribute("selected", "true");
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
if (val) {
|
||||
@ -162,11 +179,11 @@
|
||||
<getter><![CDATA[
|
||||
// A generator yielding all collapsed chatboxes, in the order in
|
||||
// which they should be restored.
|
||||
let child = this.lastChild;
|
||||
let child = this.lastElementChild;
|
||||
while (child) {
|
||||
if (child.collapsed)
|
||||
yield child;
|
||||
child = child.previousSibling;
|
||||
child = child.previousElementSibling;
|
||||
}
|
||||
]]></getter>
|
||||
</property>
|
||||
@ -174,11 +191,11 @@
|
||||
<property name="visibleChildren">
|
||||
<getter><![CDATA[
|
||||
// A generator yielding all non-collapsed chatboxes.
|
||||
let child = this.firstChild;
|
||||
let child = this.firstElementChild;
|
||||
while (child) {
|
||||
if (!child.collapsed)
|
||||
yield child;
|
||||
child = child.nextSibling;
|
||||
child = child.nextElementSibling;
|
||||
}
|
||||
]]></getter>
|
||||
</property>
|
||||
@ -194,6 +211,26 @@
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="_selectAnotherChat">
|
||||
<body><![CDATA[
|
||||
// Select a different chat (as the currently selected one is no
|
||||
// longer suitable as the selection - maybe it is being minimized or
|
||||
// closed.) We only select non-minimized and non-collapsed chats,
|
||||
// and if none are found, set the selectedChat to null.
|
||||
// It's possible in the future we will track most-recently-selected
|
||||
// chats or similar to find the "best" candidate - for now though
|
||||
// the choice is somewhat arbitrary.
|
||||
for (let other of this.children) {
|
||||
if (other != this.selectedChat && !other.minimized && !other.collapsed) {
|
||||
this.selectedChat = other;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// can't find another - so set no chat as selected.
|
||||
this.selectedChat = null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="updateTitlebar">
|
||||
<parameter name="aChatbox"/>
|
||||
<body><![CDATA[
|
||||
@ -306,7 +343,7 @@
|
||||
<parameter name="aChatbox"/>
|
||||
<body><![CDATA[
|
||||
if (this.selectedChat == aChatbox) {
|
||||
this.selectedChat = aChatbox.previousSibling ? aChatbox.previousSibling : aChatbox.nextSibling
|
||||
this._selectAnotherChat();
|
||||
}
|
||||
this.removeChild(aChatbox);
|
||||
// child might have been collapsed.
|
||||
@ -321,8 +358,9 @@
|
||||
|
||||
<method name="removeAll">
|
||||
<body><![CDATA[
|
||||
while (this.firstChild) {
|
||||
this._remove(this.firstChild);
|
||||
this.selectedChat = null;
|
||||
while (this.firstElementChild) {
|
||||
this._remove(this.firstElementChild);
|
||||
}
|
||||
// and the nub/popup must also die.
|
||||
this.nub.collapsed = true;
|
||||
@ -396,8 +434,8 @@
|
||||
cb = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "chatbox");
|
||||
if (aMode == "minimized")
|
||||
cb.setAttribute("minimized", "true");
|
||||
this.selectedChat = cb;
|
||||
this.insertBefore(cb, this.firstChild);
|
||||
this.selectedChat = cb;
|
||||
this.initChatBox(cb, aProvider, aURL, aCallback);
|
||||
this.chatboxForURL.set(aURL, Cu.getWeakReference(cb));
|
||||
this.resize();
|
||||
|
@ -659,8 +659,6 @@ function test18e() {
|
||||
ok(objLoadingContent.activated, "Test 18e, Plugin should be activated");
|
||||
|
||||
unregisterFakeBlocklistService();
|
||||
var plugin = getTestPlugin();
|
||||
plugin.clicktoplay = false;
|
||||
Services.perms.removeAll();
|
||||
|
||||
prepareTest(test19a, gTestRoot + "plugin_test.html");
|
||||
|
@ -589,7 +589,5 @@ function getPopupWidth() {
|
||||
|
||||
function closeAllChats() {
|
||||
let chatbar = window.SocialChatBar.chatbar;
|
||||
while (chatbar.selectedChat) {
|
||||
chatbar.selectedChat.close();
|
||||
}
|
||||
chatbar.removeAll();
|
||||
}
|
||||
|
@ -5230,7 +5230,6 @@ dnl enable once PeerConnection lands
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_WEBRTC)
|
||||
AC_SUBST(MOZ_WEBRTC_TESTS)
|
||||
AC_SUBST(MOZ_WEBRTC_SIGNALING)
|
||||
AC_SUBST(MOZ_PEERCONNECTION)
|
||||
AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
|
||||
|
@ -2,6 +2,9 @@
|
||||
* 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 mozAutoDocUpdate_h_
|
||||
#define mozAutoDocUpdate_h_
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
@ -82,3 +85,5 @@ public:
|
||||
private:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3,6 +3,9 @@
|
||||
* 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 nsCCUncollectableMarker_h_
|
||||
#define nsCCUncollectableMarker_h_
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -45,3 +48,5 @@ namespace dom {
|
||||
void TraceBlackJS(JSTracer* aTrc);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2505,7 +2505,11 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason)
|
||||
nsRefPtr<nsPluginHost> pluginHost =
|
||||
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
|
||||
|
||||
bool isCTP = pluginHost->IsPluginClickToPlayForType(mContentType.get());
|
||||
bool isCTP;
|
||||
nsresult rv = pluginHost->IsPluginClickToPlayForType(mContentType, &isCTP);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isCTP || mActivated) {
|
||||
return true;
|
||||
@ -2515,7 +2519,7 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason)
|
||||
aReason = eFallbackClickToPlay;
|
||||
// (if it's click-to-play, it might be because of the blocklist)
|
||||
uint32_t state;
|
||||
nsresult rv = pluginHost->GetBlocklistStateForType(mContentType.get(), &state);
|
||||
rv = pluginHost->GetBlocklistStateForType(mContentType.get(), &state);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
if (state == nsIBlocklistService::STATE_VULNERABLE_UPDATE_AVAILABLE) {
|
||||
aReason = eFallbackVulnerableUpdatable;
|
||||
|
@ -704,15 +704,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
newEvent = newFocusEvent;
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_POPUP_EVENT:
|
||||
{
|
||||
newEvent = new nsInputEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
isInputEvent = true;
|
||||
newEvent->eventStructType = NS_POPUP_EVENT;
|
||||
break;
|
||||
}
|
||||
case NS_COMMAND_EVENT:
|
||||
{
|
||||
newEvent = new nsCommandEvent(false, mEvent->userType,
|
||||
@ -1020,6 +1011,8 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return abuse;
|
||||
@ -1060,7 +1053,6 @@ nsDOMEvent::GetScreenCoords(nsPresContext* aPresContext,
|
||||
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
@ -1119,7 +1111,6 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
|
@ -111,7 +111,6 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
@ -314,7 +313,6 @@ nsDOMUIEvent::GetLayerPoint()
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
@ -62,7 +61,6 @@ public:
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
|
@ -724,7 +724,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
return NS_NewDOMCompositionEvent(
|
||||
aDOMEvent, aPresContext, static_cast<nsCompositionEvent*>(aEvent));
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_POPUP_EVENT:
|
||||
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsInputEvent*>(aEvent));
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
@ -763,10 +762,10 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
case NS_ANIMATION_EVENT:
|
||||
return NS_NewDOMAnimationEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsAnimationEvent*>(aEvent));
|
||||
default:
|
||||
// For all other types of events, create a vanilla event object.
|
||||
return NS_NewDOMEvent(aDOMEvent, aPresContext, aEvent);
|
||||
}
|
||||
|
||||
// For all other types of events, create a vanilla event object.
|
||||
return NS_NewDOMEvent(aDOMEvent, aPresContext, aEvent);
|
||||
}
|
||||
|
||||
// And if we didn't get an event, check the type argument.
|
||||
|
@ -3,13 +3,6 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/PAudioChild.h"
|
||||
#include "mozilla/dom/AudioChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
using namespace mozilla::dom;
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "prlog.h"
|
||||
@ -19,6 +12,7 @@ using namespace mozilla::dom;
|
||||
#include "AudioStream.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
extern "C" {
|
||||
#include "sydneyaudio/sydney_audio.h"
|
||||
@ -45,12 +39,6 @@ namespace mozilla {
|
||||
#define SA_PER_STREAM_VOLUME 1
|
||||
#endif
|
||||
|
||||
// Android's audio backend is not available in content processes, so
|
||||
// audio must be remoted to the parent chrome process.
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
#define REMOTE_AUDIO 1
|
||||
#endif
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* gAudioStreamLog = nullptr;
|
||||
#endif
|
||||
@ -69,7 +57,7 @@ class nsNativeAudioStream : public AudioStream
|
||||
nsNativeAudioStream();
|
||||
|
||||
nsresult Init(int32_t aNumChannels, int32_t aRate,
|
||||
const AudioChannelType aAudioChannelType);
|
||||
const dom::AudioChannelType aAudioChannelType);
|
||||
void Shutdown();
|
||||
nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
|
||||
uint32_t Available();
|
||||
@ -95,198 +83,6 @@ class nsNativeAudioStream : public AudioStream
|
||||
|
||||
};
|
||||
|
||||
#if defined(REMOTE_AUDIO)
|
||||
class nsRemotedAudioStream : public AudioStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsRemotedAudioStream();
|
||||
~nsRemotedAudioStream();
|
||||
|
||||
nsresult Init(int32_t aNumChannels, int32_t aRate,
|
||||
const AudioChannelType aAudioChannelType);
|
||||
void Shutdown();
|
||||
nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
|
||||
uint32_t Available();
|
||||
void SetVolume(double aVolume);
|
||||
void Drain();
|
||||
void Pause();
|
||||
void Resume();
|
||||
int64_t GetPosition();
|
||||
int64_t GetPositionInFrames();
|
||||
bool IsPaused();
|
||||
int32_t GetMinWriteSize();
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
|
||||
int32_t mBytesPerFrame;
|
||||
|
||||
// True if this audio stream is paused.
|
||||
bool mPaused;
|
||||
|
||||
friend class AudioInitEvent;
|
||||
};
|
||||
|
||||
class AudioInitEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioInitEvent(nsRemotedAudioStream* owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
ContentChild * cpc = ContentChild::GetSingleton();
|
||||
NS_ASSERTION(cpc, "Content Protocol is NULL!");
|
||||
mOwner->mAudioChild = static_cast<AudioChild*>(cpc->SendPAudioConstructor(mOwner->mChannels,
|
||||
mOwner->mRate));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsRemotedAudioStream> mOwner;
|
||||
};
|
||||
|
||||
class AudioWriteEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioWriteEvent(AudioChild* aChild,
|
||||
const AudioDataValue* aBuf,
|
||||
uint32_t aNumberOfFrames,
|
||||
uint32_t aBytesPerFrame)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
mBytesPerFrame = aBytesPerFrame;
|
||||
mBuffer.Assign(reinterpret_cast<const char*>(aBuf),
|
||||
aNumberOfFrames * aBytesPerFrame);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (!mAudioChild->IsIPCOpen())
|
||||
return NS_OK;
|
||||
|
||||
mAudioChild->SendWrite(mBuffer, mBuffer.Length() / mBytesPerFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
nsCString mBuffer;
|
||||
uint32_t mBytesPerFrame;
|
||||
};
|
||||
|
||||
class AudioSetVolumeEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioSetVolumeEvent(AudioChild* aChild, double aVolume)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
mVolume = aVolume;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (!mAudioChild->IsIPCOpen())
|
||||
return NS_OK;
|
||||
|
||||
mAudioChild->SendSetVolume(mVolume);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
double mVolume;
|
||||
};
|
||||
|
||||
|
||||
class AudioMinWriteSizeEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioMinWriteSizeEvent(AudioChild* aChild)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (!mAudioChild->IsIPCOpen())
|
||||
return NS_OK;
|
||||
|
||||
mAudioChild->SendMinWriteSize();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
};
|
||||
|
||||
class AudioDrainEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioDrainEvent(AudioChild* aChild)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (!mAudioChild->IsIPCOpen())
|
||||
return NS_OK;
|
||||
|
||||
mAudioChild->SendDrain();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
};
|
||||
|
||||
|
||||
class AudioPauseEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioPauseEvent(AudioChild* aChild, bool pause)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
mPause = pause;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (!mAudioChild->IsIPCOpen())
|
||||
return NS_OK;
|
||||
|
||||
if (mPause)
|
||||
mAudioChild->SendPause();
|
||||
else
|
||||
mAudioChild->SendResume();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
bool mPause;
|
||||
};
|
||||
|
||||
|
||||
class AudioShutdownEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioShutdownEvent(AudioChild* aChild)
|
||||
{
|
||||
mAudioChild = aChild;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (mAudioChild->IsIPCOpen())
|
||||
mAudioChild->SendShutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChild> mAudioChild;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define PREF_VOLUME_SCALE "media.volume_scale"
|
||||
#define PREF_USE_CUBEB "media.use_cubeb"
|
||||
#define PREF_CUBEB_LATENCY "media.cubeb_latency_ms"
|
||||
@ -359,20 +155,20 @@ static uint32_t GetCubebLatency()
|
||||
}
|
||||
#endif
|
||||
|
||||
static sa_stream_type_t ConvertChannelToSAType(AudioChannelType aType)
|
||||
static sa_stream_type_t ConvertChannelToSAType(dom::AudioChannelType aType)
|
||||
{
|
||||
switch(aType) {
|
||||
case AUDIO_CHANNEL_NORMAL:
|
||||
case dom::AUDIO_CHANNEL_NORMAL:
|
||||
return SA_STREAM_TYPE_SYSTEM;
|
||||
case AUDIO_CHANNEL_CONTENT:
|
||||
case dom::AUDIO_CHANNEL_CONTENT:
|
||||
return SA_STREAM_TYPE_MUSIC;
|
||||
case AUDIO_CHANNEL_NOTIFICATION:
|
||||
case dom::AUDIO_CHANNEL_NOTIFICATION:
|
||||
return SA_STREAM_TYPE_NOTIFICATION;
|
||||
case AUDIO_CHANNEL_ALARM:
|
||||
case dom::AUDIO_CHANNEL_ALARM:
|
||||
return SA_STREAM_TYPE_ALARM;
|
||||
case AUDIO_CHANNEL_TELEPHONY:
|
||||
case dom::AUDIO_CHANNEL_TELEPHONY:
|
||||
return SA_STREAM_TYPE_VOICE_CALL;
|
||||
case AUDIO_CHANNEL_PUBLICNOTIFICATION:
|
||||
case dom::AUDIO_CHANNEL_PUBLICNOTIFICATION:
|
||||
return SA_STREAM_TYPE_ENFORCED_AUDIBLE;
|
||||
default:
|
||||
NS_ERROR("The value of AudioChannelType is invalid");
|
||||
@ -458,7 +254,7 @@ nsNativeAudioStream::~nsNativeAudioStream()
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS0(nsNativeAudioStream)
|
||||
|
||||
nsresult nsNativeAudioStream::Init(int32_t aNumChannels, int32_t aRate,
|
||||
const AudioChannelType aAudioChannelType)
|
||||
const dom::AudioChannelType aAudioChannelType)
|
||||
{
|
||||
mRate = aRate;
|
||||
mChannels = aNumChannels;
|
||||
@ -633,143 +429,6 @@ int32_t nsNativeAudioStream::GetMinWriteSize()
|
||||
return static_cast<int32_t>(size / mChannels / sizeof(short));
|
||||
}
|
||||
|
||||
#if defined(REMOTE_AUDIO)
|
||||
nsRemotedAudioStream::nsRemotedAudioStream()
|
||||
: mAudioChild(nullptr),
|
||||
mBytesPerFrame(0),
|
||||
mPaused(false)
|
||||
{}
|
||||
|
||||
nsRemotedAudioStream::~nsRemotedAudioStream()
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS0(nsRemotedAudioStream)
|
||||
|
||||
nsresult
|
||||
nsRemotedAudioStream::Init(int32_t aNumChannels,
|
||||
int32_t aRate, AudioChannelType aAudioChannelType)
|
||||
{
|
||||
mRate = aRate;
|
||||
mChannels = aNumChannels;
|
||||
mBytesPerFrame = sizeof(AudioDataValue) * mChannels;
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = new AudioInitEvent(this);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsRemotedAudioStream::Shutdown()
|
||||
{
|
||||
if (!mAudioChild)
|
||||
return;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioShutdownEvent(mAudioChild);
|
||||
NS_DispatchToMainThread(event);
|
||||
mAudioChild = nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRemotedAudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames)
|
||||
{
|
||||
if (!mAudioChild)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioWriteEvent(mAudioChild,
|
||||
aBuf,
|
||||
aFrames,
|
||||
mBytesPerFrame);
|
||||
NS_DispatchToMainThread(event);
|
||||
mAudioChild->WaitForWrite();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsRemotedAudioStream::Available()
|
||||
{
|
||||
return FAKE_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
int32_t nsRemotedAudioStream::GetMinWriteSize()
|
||||
{
|
||||
if (!mAudioChild)
|
||||
return -1;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeEvent(mAudioChild);
|
||||
NS_DispatchToMainThread(event);
|
||||
return mAudioChild->WaitForMinWriteSize();
|
||||
}
|
||||
|
||||
void
|
||||
nsRemotedAudioStream::SetVolume(double aVolume)
|
||||
{
|
||||
if (!mAudioChild)
|
||||
return;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioSetVolumeEvent(mAudioChild, aVolume);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
void
|
||||
nsRemotedAudioStream::Drain()
|
||||
{
|
||||
if (!mAudioChild)
|
||||
return;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioDrainEvent(mAudioChild);
|
||||
NS_DispatchToMainThread(event);
|
||||
mAudioChild->WaitForDrain();
|
||||
}
|
||||
|
||||
void
|
||||
nsRemotedAudioStream::Pause()
|
||||
{
|
||||
mPaused = true;
|
||||
if (!mAudioChild)
|
||||
return;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, true);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
void
|
||||
nsRemotedAudioStream::Resume()
|
||||
{
|
||||
mPaused = false;
|
||||
if (!mAudioChild)
|
||||
return;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, false);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
int64_t nsRemotedAudioStream::GetPosition()
|
||||
{
|
||||
int64_t position = GetPositionInFrames();
|
||||
if (position >= 0) {
|
||||
return ((USECS_PER_S * position) / mRate);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t
|
||||
nsRemotedAudioStream::GetPositionInFrames()
|
||||
{
|
||||
if(!mAudioChild)
|
||||
return 0;
|
||||
|
||||
int64_t position = mAudioChild->GetLastKnownPosition();
|
||||
if (position == -1)
|
||||
return 0;
|
||||
|
||||
int64_t time = mAudioChild->GetLastKnownPositionTimestamp();
|
||||
int64_t dt = PR_IntervalToMilliseconds(PR_IntervalNow() - time);
|
||||
|
||||
return position + (mRate * dt / MS_PER_S);
|
||||
}
|
||||
|
||||
bool
|
||||
nsRemotedAudioStream::IsPaused()
|
||||
{
|
||||
return mPaused;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_CUBEB)
|
||||
class nsCircularByteBuffer
|
||||
{
|
||||
@ -845,7 +504,7 @@ class nsBufferedAudioStream : public AudioStream
|
||||
~nsBufferedAudioStream();
|
||||
|
||||
nsresult Init(int32_t aNumChannels, int32_t aRate,
|
||||
const AudioChannelType aAudioChannelType);
|
||||
const dom::AudioChannelType aAudioChannelType);
|
||||
void Shutdown();
|
||||
nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames);
|
||||
uint32_t Available();
|
||||
@ -919,11 +578,6 @@ private:
|
||||
|
||||
AudioStream* AudioStream::AllocateStream()
|
||||
{
|
||||
#if defined(REMOTE_AUDIO)
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
return new nsRemotedAudioStream();
|
||||
}
|
||||
#endif
|
||||
#if defined(MOZ_CUBEB)
|
||||
if (GetUseCubeb()) {
|
||||
return new nsBufferedAudioStream();
|
||||
@ -948,7 +602,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS0(nsBufferedAudioStream)
|
||||
|
||||
nsresult
|
||||
nsBufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
|
||||
const AudioChannelType aAudioChannelType)
|
||||
const dom::AudioChannelType aAudioChannelType)
|
||||
{
|
||||
cubeb* cubebContext = GetCubebContext();
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
// Unsafe to call with a monitor held due to synchronous event execution
|
||||
// on the main thread, which may attempt to acquire any held monitor.
|
||||
virtual nsresult Init(int32_t aNumChannels, int32_t aRate,
|
||||
const mozilla::dom::AudioChannelType aAudioStreamType) = 0;
|
||||
const dom::AudioChannelType aAudioStreamType) = 0;
|
||||
|
||||
// Closes the stream. All future use of the stream is an error.
|
||||
// Unsafe to call with a monitor held due to synchronous event execution
|
||||
|
@ -107,7 +107,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(MediaDecoder, nsIObserver)
|
||||
|
||||
void MediaDecoder::Pause()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
if (mPlayState == PLAY_STATE_SEEKING || mPlayState == PLAY_STATE_ENDED) {
|
||||
mNextState = PLAY_STATE_PAUSED;
|
||||
@ -119,7 +119,7 @@ void MediaDecoder::Pause()
|
||||
|
||||
void MediaDecoder::SetVolume(double aVolume)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mInitialVolume = aVolume;
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->SetVolume(aVolume);
|
||||
@ -128,7 +128,7 @@ void MediaDecoder::SetVolume(double aVolume)
|
||||
|
||||
void MediaDecoder::SetAudioCaptured(bool aCaptured)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mInitialAudioCaptured = aCaptured;
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->SetAudioCaptured(aCaptured);
|
||||
@ -175,7 +175,7 @@ MediaDecoder::DecodedStreamData::~DecodedStreamData()
|
||||
|
||||
void MediaDecoder::DestroyDecodedStream()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
// All streams are having their SourceMediaStream disconnected, so they
|
||||
@ -199,7 +199,7 @@ void MediaDecoder::DestroyDecodedStream()
|
||||
|
||||
void MediaDecoder::RecreateDecodedStream(int64_t aStartTimeUSecs)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoder::RecreateDecodedStream this=%p aStartTimeUSecs=%lld!",
|
||||
this, (long long)aStartTimeUSecs));
|
||||
@ -238,7 +238,7 @@ void MediaDecoder::NotifyDecodedStreamMainThreadStateChanged()
|
||||
void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream,
|
||||
bool aFinishWhenEnded)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
LOG(PR_LOG_DEBUG, ("MediaDecoder::AddOutputStream this=%p aStream=%p!",
|
||||
this, aStream));
|
||||
|
||||
@ -269,7 +269,7 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream,
|
||||
|
||||
double MediaDecoder::GetDuration()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mInfiniteStream) {
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
@ -286,13 +286,13 @@ int64_t MediaDecoder::GetMediaDuration()
|
||||
|
||||
void MediaDecoder::SetInfinite(bool aInfinite)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mInfiniteStream = aInfinite;
|
||||
}
|
||||
|
||||
bool MediaDecoder::IsInfinite()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mInfiniteStream;
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ MediaDecoder::MediaDecoder() :
|
||||
mAudioChannelType(AUDIO_CHANNEL_NORMAL)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaDecoder);
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaMemoryReporter::AddMediaDecoder(this);
|
||||
#ifdef PR_LOGGING
|
||||
if (!gMediaDecoderLog) {
|
||||
@ -329,7 +329,7 @@ MediaDecoder::MediaDecoder() :
|
||||
|
||||
bool MediaDecoder::Init(MediaDecoderOwner* aOwner)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mOwner = aOwner;
|
||||
mVideoFrameContainer = aOwner->GetVideoFrameContainer();
|
||||
nsContentUtils::RegisterShutdownObserver(this);
|
||||
@ -338,7 +338,7 @@ bool MediaDecoder::Init(MediaDecoderOwner* aOwner)
|
||||
|
||||
void MediaDecoder::Shutdown()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
@ -373,7 +373,7 @@ void MediaDecoder::Shutdown()
|
||||
|
||||
MediaDecoder::~MediaDecoder()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaMemoryReporter::RemoveMediaDecoder(this);
|
||||
UnpinForSeek();
|
||||
MOZ_COUNT_DTOR(MediaDecoder);
|
||||
@ -382,7 +382,7 @@ MediaDecoder::~MediaDecoder()
|
||||
nsresult MediaDecoder::OpenResource(MediaResource* aResource,
|
||||
nsIStreamListener** aStreamListener)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (aStreamListener) {
|
||||
*aStreamListener = nullptr;
|
||||
}
|
||||
@ -409,7 +409,7 @@ nsresult MediaDecoder::Load(MediaResource* aResource,
|
||||
nsIStreamListener** aStreamListener,
|
||||
MediaDecoder* aCloneDonor)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsresult rv = OpenResource(aResource, aStreamListener);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -425,7 +425,7 @@ nsresult MediaDecoder::Load(MediaResource* aResource,
|
||||
|
||||
nsresult MediaDecoder::InitializeStateMachine(MediaDecoder* aCloneDonor)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
MediaDecoder* cloneDonor = static_cast<MediaDecoder*>(aCloneDonor);
|
||||
if (NS_FAILED(mDecoderStateMachine->Init(cloneDonor ?
|
||||
@ -467,7 +467,7 @@ nsresult MediaDecoder::RequestFrameBufferLength(uint32_t aLength)
|
||||
|
||||
nsresult MediaDecoder::ScheduleStateMachineThread()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_ASSERTION(mDecoderStateMachine,
|
||||
"Must have state machine to start state machine thread");
|
||||
NS_ENSURE_STATE(mDecoderStateMachine);
|
||||
@ -482,7 +482,7 @@ nsresult MediaDecoder::ScheduleStateMachineThread()
|
||||
|
||||
nsresult MediaDecoder::Play()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
NS_ASSERTION(mDecoderStateMachine != nullptr, "Should have state machine.");
|
||||
nsresult res = ScheduleStateMachineThread();
|
||||
@ -527,7 +527,7 @@ static bool IsInRanges(nsTimeRanges& aRanges, double aValue, int32_t& aIntervalI
|
||||
|
||||
nsresult MediaDecoder::Seek(double aTime)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
|
||||
NS_ABORT_IF_FALSE(aTime >= 0.0, "Cannot seek to a negative value.");
|
||||
@ -600,19 +600,19 @@ nsresult MediaDecoder::Seek(double aTime)
|
||||
|
||||
nsresult MediaDecoder::PlaybackRateChanged()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
double MediaDecoder::GetCurrentTime()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mCurrentTime;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPrincipal> MediaDecoder::GetCurrentPrincipal()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mResource ? mResource->GetCurrentPrincipal() : nullptr;
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ void MediaDecoder::AudioAvailable(float* aFrameBuffer,
|
||||
// here, this ensures we free the memory. Otherwise, we pass off ownership
|
||||
// to HTMLMediaElement::NotifyAudioAvailable().
|
||||
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown || !mOwner) {
|
||||
return;
|
||||
}
|
||||
@ -636,7 +636,7 @@ void MediaDecoder::MetadataLoaded(uint32_t aChannels,
|
||||
bool aHasAudio,
|
||||
const MetadataTags* aTags)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
@ -703,7 +703,7 @@ void MediaDecoder::MetadataLoaded(uint32_t aChannels,
|
||||
|
||||
void MediaDecoder::ResourceLoaded()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Don't handle ResourceLoaded if we are shutting down, or if
|
||||
// we need to ignore progress data due to seeking (in the case
|
||||
@ -733,7 +733,7 @@ void MediaDecoder::ResourceLoaded()
|
||||
|
||||
void MediaDecoder::NetworkError()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
@ -745,7 +745,7 @@ void MediaDecoder::NetworkError()
|
||||
|
||||
void MediaDecoder::DecodeError()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
@ -757,19 +757,19 @@ void MediaDecoder::DecodeError()
|
||||
|
||||
bool MediaDecoder::IsSeeking() const
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mPlayState == PLAY_STATE_SEEKING;
|
||||
}
|
||||
|
||||
bool MediaDecoder::IsEnded() const
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mPlayState == PLAY_STATE_ENDED || mPlayState == PLAY_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
void MediaDecoder::PlaybackEnded()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mShuttingDown || mPlayState == MediaDecoder::PLAY_STATE_SEEKING)
|
||||
return;
|
||||
@ -818,7 +818,7 @@ NS_IMETHODIMP MediaDecoder::Observe(nsISupports *aSubjet,
|
||||
const char *aTopic,
|
||||
const PRUnichar *someData)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
|
||||
Shutdown();
|
||||
}
|
||||
@ -829,8 +829,7 @@ NS_IMETHODIMP MediaDecoder::Observe(nsISupports *aSubjet,
|
||||
MediaDecoder::Statistics
|
||||
MediaDecoder::GetStatistics()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread() || OnStateMachineThread(),
|
||||
"Should be on main or state machine thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread() || OnStateMachineThread());
|
||||
Statistics result;
|
||||
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
@ -861,8 +860,7 @@ MediaDecoder::GetStatistics()
|
||||
double MediaDecoder::ComputePlaybackRate(bool* aReliable)
|
||||
{
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
NS_ASSERTION(NS_IsMainThread() || OnStateMachineThread(),
|
||||
"Should be on main or state machine thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread() || OnStateMachineThread());
|
||||
|
||||
int64_t length = mResource ? mResource->GetLength() : -1;
|
||||
if (mDuration >= 0 && length >= 0) {
|
||||
@ -874,8 +872,7 @@ double MediaDecoder::ComputePlaybackRate(bool* aReliable)
|
||||
|
||||
void MediaDecoder::UpdatePlaybackRate()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread() || OnStateMachineThread(),
|
||||
"Should be on main or state machine thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread() || OnStateMachineThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
if (!mResource)
|
||||
return;
|
||||
@ -895,7 +892,7 @@ void MediaDecoder::UpdatePlaybackRate()
|
||||
|
||||
void MediaDecoder::NotifySuspendedStatusChanged()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mResource)
|
||||
return;
|
||||
MediaResource* activeStream;
|
||||
@ -914,14 +911,14 @@ void MediaDecoder::NotifySuspendedStatusChanged()
|
||||
|
||||
void MediaDecoder::NotifyBytesDownloaded()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
UpdateReadyStateForData();
|
||||
Progress(false);
|
||||
}
|
||||
|
||||
void MediaDecoder::NotifyDownloadEnded(nsresult aStatus)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (aStatus == NS_BINDING_ABORTED) {
|
||||
// Download has been cancelled by user.
|
||||
@ -955,8 +952,7 @@ void MediaDecoder::NotifyPrincipalChanged()
|
||||
void MediaDecoder::NotifyBytesConsumed(int64_t aBytes)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
NS_ASSERTION(OnStateMachineThread() || mDecoderStateMachine->OnDecodeThread(),
|
||||
"Should be on play state machine or decode thread.");
|
||||
MOZ_ASSERT(OnStateMachineThread() || mDecoderStateMachine->OnDecodeThread());
|
||||
if (!mIgnoreProgressData) {
|
||||
mDecoderPosition += aBytes;
|
||||
mPlaybackStatistics.AddBytes(aBytes);
|
||||
@ -965,7 +961,7 @@ void MediaDecoder::NotifyBytesConsumed(int64_t aBytes)
|
||||
|
||||
void MediaDecoder::NextFrameUnavailableBuffering()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be called on main thread");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine)
|
||||
return;
|
||||
|
||||
@ -974,7 +970,7 @@ void MediaDecoder::NextFrameUnavailableBuffering()
|
||||
|
||||
void MediaDecoder::NextFrameAvailable()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be called on main thread");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine)
|
||||
return;
|
||||
|
||||
@ -983,7 +979,7 @@ void MediaDecoder::NextFrameAvailable()
|
||||
|
||||
void MediaDecoder::NextFrameUnavailable()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be called on main thread");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine)
|
||||
return;
|
||||
mOwner->UpdateReadyStateForData(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE);
|
||||
@ -991,7 +987,7 @@ void MediaDecoder::NextFrameUnavailable()
|
||||
|
||||
void MediaDecoder::UpdateReadyStateForData()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be called on main thread");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine)
|
||||
return;
|
||||
MediaDecoderOwner::NextFrameStatus frameStatus =
|
||||
@ -1001,7 +997,7 @@ void MediaDecoder::UpdateReadyStateForData()
|
||||
|
||||
void MediaDecoder::SeekingStopped()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
@ -1033,7 +1029,7 @@ void MediaDecoder::SeekingStopped()
|
||||
// media.
|
||||
void MediaDecoder::SeekingStoppedAtEnd()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
@ -1068,7 +1064,7 @@ void MediaDecoder::SeekingStoppedAtEnd()
|
||||
|
||||
void MediaDecoder::SeekingStarted()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
@ -1080,7 +1076,7 @@ void MediaDecoder::SeekingStarted()
|
||||
|
||||
void MediaDecoder::ChangeState(PlayState aState)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
|
||||
if (mNextState == aState) {
|
||||
@ -1119,7 +1115,7 @@ void MediaDecoder::ChangeState(PlayState aState)
|
||||
|
||||
void MediaDecoder::PlaybackPositionChanged()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
@ -1157,7 +1153,7 @@ void MediaDecoder::PlaybackPositionChanged()
|
||||
|
||||
void MediaDecoder::DurationChanged()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
int64_t oldDuration = mDuration;
|
||||
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
|
||||
@ -1172,7 +1168,7 @@ void MediaDecoder::DurationChanged()
|
||||
|
||||
void MediaDecoder::SetDuration(double aDuration)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mDuration = static_cast<int64_t>(NS_round(aDuration * static_cast<double>(USECS_PER_S)));
|
||||
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
@ -1191,7 +1187,7 @@ void MediaDecoder::SetMediaDuration(int64_t aDuration)
|
||||
|
||||
void MediaDecoder::SetSeekable(bool aSeekable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mSeekable = aSeekable;
|
||||
if (mDecoderStateMachine) {
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
@ -1201,7 +1197,7 @@ void MediaDecoder::SetSeekable(bool aSeekable)
|
||||
|
||||
bool MediaDecoder::IsSeekable()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mSeekable;
|
||||
}
|
||||
|
||||
@ -1233,7 +1229,7 @@ nsresult MediaDecoder::GetSeekable(nsTimeRanges* aSeekable)
|
||||
|
||||
void MediaDecoder::SetFragmentEndTime(double aTime)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mDecoderStateMachine) {
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mDecoderStateMachine->SetFragmentEndTime(static_cast<int64_t>(aTime * USECS_PER_S));
|
||||
@ -1247,7 +1243,7 @@ void MediaDecoder::SetMediaEndTime(int64_t aTime)
|
||||
|
||||
void MediaDecoder::Suspend()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
mResource->Suspend(true);
|
||||
}
|
||||
@ -1255,7 +1251,7 @@ void MediaDecoder::Suspend()
|
||||
|
||||
void MediaDecoder::Resume(bool aForceBuffering)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
mResource->Resume();
|
||||
}
|
||||
@ -1269,8 +1265,7 @@ void MediaDecoder::Resume(bool aForceBuffering)
|
||||
|
||||
void MediaDecoder::StopProgressUpdates()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
|
||||
"Should be on state machine or decode thread.");
|
||||
MOZ_ASSERT(OnStateMachineThread() || OnDecodeThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mIgnoreProgressData = true;
|
||||
if (mResource) {
|
||||
@ -1280,8 +1275,7 @@ void MediaDecoder::StopProgressUpdates()
|
||||
|
||||
void MediaDecoder::StartProgressUpdates()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
|
||||
"Should be on state machine or decode thread.");
|
||||
MOZ_ASSERT(OnStateMachineThread() || OnDecodeThread());
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mIgnoreProgressData = false;
|
||||
if (mResource) {
|
||||
@ -1292,7 +1286,7 @@ void MediaDecoder::StartProgressUpdates()
|
||||
|
||||
void MediaDecoder::MoveLoadsToBackground()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
mResource->MoveLoadsToBackground();
|
||||
}
|
||||
@ -1311,7 +1305,7 @@ bool MediaDecoder::OnStateMachineThread() const
|
||||
|
||||
void MediaDecoder::NotifyAudioAvailableListener()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mDecoderStateMachine) {
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mDecoderStateMachine->NotifyAudioAvailableListener();
|
||||
|
@ -49,7 +49,7 @@ namespace mozilla {
|
||||
|
||||
ChannelMediaResource::ChannelMediaResource(MediaDecoder* aDecoder,
|
||||
nsIChannel* aChannel, nsIURI* aURI)
|
||||
: MediaResource(aDecoder, aChannel, aURI),
|
||||
: BaseMediaResource(aDecoder, aChannel, aURI),
|
||||
mOffset(0), mSuspendCount(0),
|
||||
mReopenOnError(false), mIgnoreClose(false),
|
||||
mCacheStream(this),
|
||||
@ -1153,11 +1153,11 @@ ChannelMediaResource::PossiblyResume()
|
||||
}
|
||||
}
|
||||
|
||||
class FileMediaResource : public MediaResource
|
||||
class FileMediaResource : public BaseMediaResource
|
||||
{
|
||||
public:
|
||||
FileMediaResource(MediaDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI) :
|
||||
MediaResource(aDecoder, aChannel, aURI),
|
||||
BaseMediaResource(aDecoder, aChannel, aURI),
|
||||
mSize(-1),
|
||||
mLock("FileMediaResource.mLock"),
|
||||
mSizeInitialized(false)
|
||||
@ -1514,7 +1514,7 @@ MediaResource::Create(MediaDecoder* aDecoder, nsIChannel* aChannel)
|
||||
return new ChannelMediaResource(aDecoder, aChannel, uri);
|
||||
}
|
||||
|
||||
void MediaResource::MoveLoadsToBackground() {
|
||||
void BaseMediaResource::MoveLoadsToBackground() {
|
||||
NS_ASSERTION(!mLoadInBackground, "Why are you calling this more than once?");
|
||||
mLoadInBackground = true;
|
||||
if (!mChannel) {
|
||||
@ -1545,7 +1545,7 @@ void MediaResource::MoveLoadsToBackground() {
|
||||
}
|
||||
}
|
||||
|
||||
void MediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
|
||||
void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
|
||||
{
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
DebugOnly<nsresult> rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
@ -146,14 +146,11 @@ public:
|
||||
class MediaResource
|
||||
{
|
||||
public:
|
||||
virtual ~MediaResource()
|
||||
{
|
||||
MOZ_COUNT_DTOR(MediaResource);
|
||||
}
|
||||
virtual ~MediaResource() {}
|
||||
|
||||
// The following can be called on the main thread only:
|
||||
// Get the URI
|
||||
nsIURI* URI() const { return mURI; }
|
||||
virtual nsIURI* URI() const { return nullptr; }
|
||||
// Close the resource, stop any listeners, channels, etc.
|
||||
// Cancels any currently blocking Read request and forces that request to
|
||||
// return an error.
|
||||
@ -227,7 +224,7 @@ public:
|
||||
// Moves any existing channel loads into the background, so that they don't
|
||||
// block the load event. Any new loads initiated (for example to seek)
|
||||
// will also be in the background.
|
||||
void MoveLoadsToBackground();
|
||||
virtual void MoveLoadsToBackground() {}
|
||||
// Ensures that the value returned by IsSuspendedByCache below is up to date
|
||||
// (i.e. the cache has examined this stream at least once).
|
||||
virtual void EnsureCacheUpToDate() {}
|
||||
@ -307,15 +304,25 @@ public:
|
||||
* aRanges is being used.
|
||||
*/
|
||||
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) = 0;
|
||||
};
|
||||
|
||||
class BaseMediaResource : public MediaResource {
|
||||
public:
|
||||
virtual nsIURI* URI() const { return mURI; }
|
||||
virtual void MoveLoadsToBackground();
|
||||
|
||||
protected:
|
||||
MediaResource(MediaDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI) :
|
||||
BaseMediaResource(MediaDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI) :
|
||||
mDecoder(aDecoder),
|
||||
mChannel(aChannel),
|
||||
mURI(aURI),
|
||||
mLoadInBackground(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaResource);
|
||||
MOZ_COUNT_CTOR(BaseMediaResource);
|
||||
}
|
||||
virtual ~BaseMediaResource()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BaseMediaResource);
|
||||
}
|
||||
|
||||
// Set the request's load flags to aFlags. If the request is part of a
|
||||
@ -349,7 +356,7 @@ protected:
|
||||
* All synchronization is performed by MediaCacheStream; all off-main-
|
||||
* thread operations are delegated directly to that object.
|
||||
*/
|
||||
class ChannelMediaResource : public MediaResource
|
||||
class ChannelMediaResource : public BaseMediaResource
|
||||
{
|
||||
public:
|
||||
ChannelMediaResource(MediaDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI);
|
||||
|
@ -59,9 +59,9 @@ public:
|
||||
return mLength;
|
||||
}
|
||||
|
||||
float Duration() const
|
||||
double Duration() const
|
||||
{
|
||||
return mLength / mSampleRate;
|
||||
return mLength / static_cast<double> (mSampleRate);
|
||||
}
|
||||
|
||||
uint32_t NumberOfChannels() const
|
||||
|
@ -104,9 +104,9 @@ AudioContext::CreateGain()
|
||||
}
|
||||
|
||||
already_AddRefed<DelayNode>
|
||||
AudioContext::CreateDelay(float aMaxDelayTime, ErrorResult& aRv)
|
||||
AudioContext::CreateDelay(double aMaxDelayTime, ErrorResult& aRv)
|
||||
{
|
||||
if (aMaxDelayTime > 0.f && aMaxDelayTime < 3.f) {
|
||||
if (aMaxDelayTime > 0. && aMaxDelayTime < 3.) {
|
||||
nsRefPtr<DelayNode> delayNode = new DelayNode(this, aMaxDelayTime);
|
||||
return delayNode.forget();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
CreateGain();
|
||||
|
||||
already_AddRefed<DelayNode>
|
||||
CreateDelay(float aMaxDelayTime, ErrorResult& aRv);
|
||||
CreateDelay(double aMaxDelayTime, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<PannerNode>
|
||||
CreatePanner();
|
||||
|
@ -41,11 +41,11 @@ private:
|
||||
SetValueCurve
|
||||
};
|
||||
|
||||
Event(Type aType, float aTime, float aValue, float aTimeConstant = 0.0,
|
||||
Event(Type aType, double aTime, float aValue, double aTimeConstant = 0.0,
|
||||
float aDuration = 0.0, FloatArrayWrapper aCurve = FloatArrayWrapper())
|
||||
: mType(aType)
|
||||
, mTime(aTime)
|
||||
, mValue(aValue)
|
||||
, mTime(aTime)
|
||||
, mTimeConstant(aTimeConstant)
|
||||
, mDuration(aDuration)
|
||||
{
|
||||
@ -63,10 +63,10 @@ private:
|
||||
}
|
||||
|
||||
Type mType;
|
||||
float mTime;
|
||||
float mValue;
|
||||
float mTimeConstant;
|
||||
float mDuration;
|
||||
double mTime;
|
||||
double mTimeConstant;
|
||||
double mDuration;
|
||||
FloatArrayWrapper mCurve;
|
||||
|
||||
private:
|
||||
@ -125,33 +125,33 @@ public:
|
||||
return mDefaultValue;
|
||||
}
|
||||
|
||||
void SetValueAtTime(float aValue, float aStartTime, ErrorResult& aRv)
|
||||
void SetValueAtTime(float aValue, double aStartTime, ErrorResult& aRv)
|
||||
{
|
||||
InsertEvent(Event(Event::SetValue, aStartTime, aValue), aRv);
|
||||
}
|
||||
|
||||
void LinearRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
|
||||
void LinearRampToValueAtTime(float aValue, double aEndTime, ErrorResult& aRv)
|
||||
{
|
||||
InsertEvent(Event(Event::LinearRamp, aEndTime, aValue), aRv);
|
||||
}
|
||||
|
||||
void ExponentialRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
|
||||
void ExponentialRampToValueAtTime(float aValue, double aEndTime, ErrorResult& aRv)
|
||||
{
|
||||
InsertEvent(Event(Event::ExponentialRamp, aEndTime, aValue), aRv);
|
||||
}
|
||||
|
||||
void SetTargetAtTime(float aTarget, float aStartTime, float aTimeConstant, ErrorResult& aRv)
|
||||
void SetTargetAtTime(float aTarget, double aStartTime, double aTimeConstant, ErrorResult& aRv)
|
||||
{
|
||||
InsertEvent(Event(Event::SetTarget, aStartTime, aTarget, aTimeConstant), aRv);
|
||||
}
|
||||
|
||||
void SetValueCurveAtTime(const FloatArrayWrapper& aValues, float aStartTime, float aDuration, ErrorResult& aRv)
|
||||
void SetValueCurveAtTime(const FloatArrayWrapper& aValues, double aStartTime, double aDuration, ErrorResult& aRv)
|
||||
{
|
||||
// TODO: implement
|
||||
// InsertEvent(Event(Event::SetValueCurve, aStartTime, 0.0f, 0.0f, aDuration, aValues), aRv);
|
||||
}
|
||||
|
||||
void CancelScheduledValues(float aStartTime)
|
||||
void CancelScheduledValues(double aStartTime)
|
||||
{
|
||||
for (unsigned i = 0; i < mEvents.Length(); ++i) {
|
||||
if (mEvents[i].mTime >= aStartTime) {
|
||||
@ -169,7 +169,7 @@ public:
|
||||
}
|
||||
|
||||
// This method computes the AudioParam value at a given time based on the event timeline
|
||||
float GetValueAtTime(float aTime) const
|
||||
float GetValueAtTime(double aTime) const
|
||||
{
|
||||
const Event* previous = nullptr;
|
||||
const Event* next = nullptr;
|
||||
@ -222,10 +222,10 @@ public:
|
||||
return mValue;
|
||||
case Event::LinearRamp:
|
||||
// Use t=0 as T0 and v=defaultValue as V0
|
||||
return LinearInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
|
||||
return LinearInterpolate(0.0, mValue, next->mTime, next->mValue, aTime);
|
||||
case Event::ExponentialRamp:
|
||||
// Use t=0 as T0 and v=defaultValue as V0
|
||||
return ExponentialInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
|
||||
return ExponentialInterpolate(0.0, mValue, next->mTime, next->mValue, aTime);
|
||||
case Event::SetValueCurve:
|
||||
// TODO: implement
|
||||
return 0.0f;
|
||||
@ -296,17 +296,17 @@ public:
|
||||
return mEvents.Length();
|
||||
}
|
||||
|
||||
static float LinearInterpolate(float t0, float v0, float t1, float v1, float t)
|
||||
static float LinearInterpolate(double t0, float v0, double t1, float v1, double t)
|
||||
{
|
||||
return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
|
||||
}
|
||||
|
||||
static float ExponentialInterpolate(float t0, float v0, float t1, float v1, float t)
|
||||
static float ExponentialInterpolate(double t0, float v0, double t1, float v1, double t)
|
||||
{
|
||||
return v0 * powf(v1 / v0, (t - t0) / (t1 - t0));
|
||||
}
|
||||
|
||||
static float ExponentialApproach(float t0, float v0, float v1, float timeConstant, float t)
|
||||
static float ExponentialApproach(double t0, double v0, float v1, double timeConstant, double t)
|
||||
{
|
||||
return v1 + (v0 - v1) * expf(-(t - t0) / timeConstant);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ AudioParam::~AudioParam()
|
||||
|
||||
JSObject*
|
||||
AudioParam::WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
bool* aTriedToWrap)
|
||||
{
|
||||
return AudioParamBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
|
||||
// We override SetValueCurveAtTime to convert the Float32Array to the wrapper
|
||||
// object.
|
||||
void SetValueCurveAtTime(JSContext* cx, const Float32Array& aValues, float aStartTime, float aDuration, ErrorResult& aRv)
|
||||
void SetValueCurveAtTime(JSContext* cx, const Float32Array& aValues, double aStartTime, double aDuration, ErrorResult& aRv)
|
||||
{
|
||||
AudioParamTimeline::SetValueCurveAtTime(detail::FloatArrayWrapper(aValues),
|
||||
aStartTime, aDuration, aRv);
|
||||
|
@ -24,7 +24,7 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
|
||||
NS_IMPL_ADDREF_INHERITED(DelayNode, AudioNode)
|
||||
NS_IMPL_RELEASE_INHERITED(DelayNode, AudioNode)
|
||||
|
||||
DelayNode::DelayNode(AudioContext* aContext, float aMaxDelay)
|
||||
DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
|
||||
: AudioNode(aContext)
|
||||
, mDelay(new AudioParam(aContext, 0.0f, 0.0f, aMaxDelay))
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class AudioContext;
|
||||
class DelayNode : public AudioNode
|
||||
{
|
||||
public:
|
||||
DelayNode(AudioContext* aContext, float aMaxDelay);
|
||||
DelayNode(AudioContext* aContext, double aMaxDelay);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DelayNode, AudioNode)
|
||||
|
@ -105,14 +105,14 @@ void TestSpecExample()
|
||||
ErrorResultMock rv;
|
||||
|
||||
// This test is copied from the example in the Web Audio spec
|
||||
const float t0 = 0.0f,
|
||||
t1 = 0.1f,
|
||||
t2 = 0.2f,
|
||||
t3 = 0.3f,
|
||||
t4 = 0.4f,
|
||||
t5 = 0.6f,
|
||||
t6 = 0.7f/*,
|
||||
t7 = 1.0f*/;
|
||||
const float t0 = 0.0,
|
||||
t1 = 0.1,
|
||||
t2 = 0.2,
|
||||
t3 = 0.3,
|
||||
t4 = 0.4,
|
||||
t5 = 0.6,
|
||||
t6 = 0.7/*,
|
||||
t7 = 1.0*/;
|
||||
timeline.SetValueAtTime(0.2f, t0, rv);
|
||||
is(rv, NS_OK, "SetValueAtTime succeeded");
|
||||
timeline.SetValueAtTime(0.3f, t1, rv);
|
||||
@ -156,35 +156,35 @@ void TestInvalidEvents()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(NaN, 0.1f, rv);
|
||||
timeline.SetValueAtTime(NaN, 0.1, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetValueAtTime(Infinity, 0.1f, rv);
|
||||
timeline.SetValueAtTime(Infinity, 0.1, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetValueAtTime(-Infinity, 0.1f, rv);
|
||||
timeline.SetValueAtTime(-Infinity, 0.1, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.LinearRampToValueAtTime(NaN, 0.2f, rv);
|
||||
timeline.LinearRampToValueAtTime(NaN, 0.2, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.LinearRampToValueAtTime(Infinity, 0.2f, rv);
|
||||
timeline.LinearRampToValueAtTime(Infinity, 0.2, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.LinearRampToValueAtTime(-Infinity, 0.2f, rv);
|
||||
timeline.LinearRampToValueAtTime(-Infinity, 0.2, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.ExponentialRampToValueAtTime(NaN, 0.3f, rv);
|
||||
timeline.ExponentialRampToValueAtTime(NaN, 0.3, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.ExponentialRampToValueAtTime(Infinity, 0.3f, rv);
|
||||
timeline.ExponentialRampToValueAtTime(Infinity, 0.3, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.ExponentialRampToValueAtTime(-Infinity, 0.4f, rv);
|
||||
timeline.ExponentialRampToValueAtTime(-Infinity, 0.4, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(NaN, 0.4f, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(NaN, 0.4, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(Infinity, 0.4f, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(Infinity, 0.4, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(-Infinity, 0.4f, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(-Infinity, 0.4, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(0.4f, NaN, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(0.4f, NaN, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(0.4f, Infinity, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(0.4f, Infinity, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
timeline.SetTargetAtTime(0.4f, -Infinity, 1.0f, rv);
|
||||
timeline.SetTargetAtTime(0.4f, -Infinity, 1.0, rv);
|
||||
is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
|
||||
// TODO: Test SetValueCurveAtTime
|
||||
}
|
||||
@ -196,13 +196,13 @@ void TestEventReplacement()
|
||||
ErrorResultMock rv;
|
||||
|
||||
is(timeline.GetEventCount(), 0, "No events yet");
|
||||
timeline.SetValueAtTime(10.0f, 0.1f, rv);
|
||||
timeline.SetValueAtTime(10.0f, 0.1, rv);
|
||||
is(timeline.GetEventCount(), 1, "One event scheduled now");
|
||||
timeline.SetValueAtTime(20.0f, 0.1f, rv);
|
||||
timeline.SetValueAtTime(20.0f, 0.1, rv);
|
||||
is(rv, NS_OK, "Event scheduling should be successful");
|
||||
is(timeline.GetEventCount(), 1, "Event should be replaced");
|
||||
is(timeline.GetValueAtTime(0.1f), 20.0f, "The first event should be overwritten");
|
||||
timeline.LinearRampToValueAtTime(30.0f, 0.1f, rv);
|
||||
timeline.LinearRampToValueAtTime(30.0f, 0.1, rv);
|
||||
is(rv, NS_OK, "Event scheduling should be successful");
|
||||
is(timeline.GetEventCount(), 2, "Different event type should be appended");
|
||||
is(timeline.GetValueAtTime(0.1f), 30.0f, "The first event should be overwritten");
|
||||
@ -214,16 +214,16 @@ void TestEventRemoval()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(10.0f, 0.1f, rv);
|
||||
timeline.SetValueAtTime(15.0f, 0.15f, rv);
|
||||
timeline.SetValueAtTime(20.0f, 0.2f, rv);
|
||||
timeline.LinearRampToValueAtTime(30.0f, 0.3f, rv);
|
||||
timeline.SetValueAtTime(10.0f, 0.1, rv);
|
||||
timeline.SetValueAtTime(15.0f, 0.15, rv);
|
||||
timeline.SetValueAtTime(20.0f, 0.2, rv);
|
||||
timeline.LinearRampToValueAtTime(30.0f, 0.3, rv);
|
||||
is(timeline.GetEventCount(), 4, "Should have three events initially");
|
||||
timeline.CancelScheduledValues(0.4f);
|
||||
timeline.CancelScheduledValues(0.4);
|
||||
is(timeline.GetEventCount(), 4, "Trying to delete past the end of the array should have no effect");
|
||||
timeline.CancelScheduledValues(0.3f);
|
||||
timeline.CancelScheduledValues(0.3);
|
||||
is(timeline.GetEventCount(), 3, "Should successfully delete one event");
|
||||
timeline.CancelScheduledValues(0.12f);
|
||||
timeline.CancelScheduledValues(0.12);
|
||||
is(timeline.GetEventCount(), 1, "Should successfully delete two events");
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ void TestBeforeFirstEvent()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(20.0f, 1.0f, rv);
|
||||
timeline.SetValueAtTime(20.0f, 1.0, rv);
|
||||
is(timeline.GetValueAtTime(0.5f), 10.0f, "Retrun the default value before the first event");
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ void TestAfterLastValueEvent()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(20.0f, 1.0f, rv);
|
||||
timeline.SetValueAtTime(20.0f, 1.0, rv);
|
||||
is(timeline.GetValueAtTime(1.5f), 20.0f, "Return the last value after the last SetValue event");
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ void TestAfterLastTargetValueEvent()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetTargetAtTime(20.0f, 1.0f, 5.0f, rv);
|
||||
timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
|
||||
is(timeline.GetValueAtTime(10.f), (20.f + (10.f - 20.f) * expf(-9.0f / 5.0f)), "Return the value after the last SetTarget event based on the curve");
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ void TestAfterLastTargetValueEventWithValueSet()
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValue(50.f);
|
||||
timeline.SetTargetAtTime(20.0f, 1.0f, 5.0f, rv);
|
||||
timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
|
||||
is(timeline.GetValueAtTime(10.f), (20.f + (50.f - 20.f) * expf(-9.0f / 5.0f)), "Return the value after SetValue and the last SetTarget event based on the curve");
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ void TestValue()
|
||||
is(timeline.Value(), 10.0f, "value should initially match the default value");
|
||||
timeline.SetValue(20.0f);
|
||||
is(timeline.Value(), 20.0f, "Should be able to set the value");
|
||||
timeline.SetValueAtTime(20.0f, 1.0f, rv);
|
||||
timeline.SetValueAtTime(20.0f, 1.0, rv);
|
||||
// TODO: The following check needs to change when we compute the value based on the current time of the context
|
||||
is(timeline.Value(), 20.0f, "TODO...");
|
||||
timeline.SetValue(30.0f);
|
||||
@ -290,7 +290,7 @@ void TestLinearRampAtZero()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.LinearRampToValueAtTime(20.0f, 0.0f, rv);
|
||||
timeline.LinearRampToValueAtTime(20.0f, 0.0, rv);
|
||||
is(timeline.GetValueAtTime(0.0f), 20.0f, "Should get the correct value when t0 == t1 == 0");
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ void TestExponentialRampAtZero()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.ExponentialRampToValueAtTime(20.0f, 0.0f, rv);
|
||||
timeline.ExponentialRampToValueAtTime(20.0f, 0.0, rv);
|
||||
is(timeline.GetValueAtTime(0.0f), 20.0f, "Should get the correct value when t0 == t1 == 0");
|
||||
}
|
||||
|
||||
@ -310,8 +310,8 @@ void TestLinearRampAtSameTime()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(5.0f, 1.0f, rv);
|
||||
timeline.LinearRampToValueAtTime(20.0f, 1.0f, rv);
|
||||
timeline.SetValueAtTime(5.0f, 1.0, rv);
|
||||
timeline.LinearRampToValueAtTime(20.0f, 1.0, rv);
|
||||
is(timeline.GetValueAtTime(1.0f), 20.0f, "Should get the correct value when t0 == t1");
|
||||
}
|
||||
|
||||
@ -321,8 +321,8 @@ void TestExponentialRampAtSameTime()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetValueAtTime(5.0f, 1.0f, rv);
|
||||
timeline.ExponentialRampToValueAtTime(20.0f, 1.0f, rv);
|
||||
timeline.SetValueAtTime(5.0f, 1.0, rv);
|
||||
timeline.ExponentialRampToValueAtTime(20.0f, 1.0, rv);
|
||||
is(timeline.GetValueAtTime(1.0f), 20.0f, "Should get the correct value when t0 == t1");
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ void TestSetTargetZeroTimeConstant()
|
||||
|
||||
ErrorResultMock rv;
|
||||
|
||||
timeline.SetTargetAtTime(20.0f, 1.0f, 0.0f, rv);
|
||||
timeline.SetTargetAtTime(20.0f, 1.0, 0.0, rv);
|
||||
is(timeline.GetValueAtTime(10.f), 20.f, "Should get the correct value with timeConstant == 0");
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsXBLService_h_
|
||||
#define nsXBLService_h_
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
@ -141,3 +144,4 @@ public:
|
||||
nsrefcnt Drop() { return --mRefCnt ? mRefCnt : Destroy(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -271,6 +271,7 @@ this.PermissionsTable = { "resource-lock": {
|
||||
this.expandPermissions = function expandPermissions(aPermName, aAccess) {
|
||||
if (!PermissionsTable[aPermName]) {
|
||||
Cu.reportError("PermissionsTable.jsm: expandPermissions: Unknown Permission: " + aPermName);
|
||||
dump("PermissionsTable.jsm: expandPermissions: Unknown Permission: " + aPermName);
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -282,15 +283,15 @@ this.expandPermissions = function expandPermissions(aPermName, aAccess) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/*
|
||||
Temporarily disabled in order to add access fields to gaia: See Bug 805646
|
||||
if (!aAccess && tableEntry.access ||
|
||||
aAccess && !tableEntry.access) {
|
||||
Cu.reportError("PermissionsTable.jsm: expandPermissions: Invalid Manifest : " +
|
||||
aPermName + " " + aAccess + "\n");
|
||||
throw new Error("PermissionsTable.jsm: expandPermissions: Invalid Manifest");
|
||||
dump("PermissionsTable.jsm: expandPermissions: Invalid Manifest: " +
|
||||
aPermName + " " + aAccess + "\n");
|
||||
throw new Error("PermissionsTable.jsm: expandPermissions: Invalid Manifest: " +
|
||||
aPermName + " " + aAccess + "\n");
|
||||
}
|
||||
*/
|
||||
|
||||
let expandedPerms = [];
|
||||
|
||||
@ -313,28 +314,16 @@ Temporarily disabled in order to add access fields to gaia: See Bug 805646
|
||||
return [];
|
||||
}
|
||||
|
||||
// XXXbent This is a temporary hack! Remove this whole block once the
|
||||
// Settings API and the DeviceStorage API have stopped checking just
|
||||
// the bare permission (e.g. "settings" vs. "settings-read").
|
||||
if (true) {
|
||||
expandedPerms.push(aPermName);
|
||||
if (tableEntry.additional) {
|
||||
for each (let additional in tableEntry.additional) {
|
||||
expandedPerms.push(additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let permArr = mapSuffixes(aPermName, requestedSuffixes);
|
||||
|
||||
// Add the same suffix to each of the additions.
|
||||
if (tableEntry.additional) {
|
||||
for each (let additional in tableEntry.additional) {
|
||||
permArr = permArr.concat(mapSuffixes(additional, requestedSuffixes));
|
||||
}
|
||||
// Add the same suffix to each of the additions.
|
||||
if (tableEntry.additional) {
|
||||
for each (let additional in tableEntry.additional) {
|
||||
permArr = permArr.concat(mapSuffixes(additional, requestedSuffixes));
|
||||
}
|
||||
}
|
||||
|
||||
// Only add the suffixed version if the suffix exisits in the table.
|
||||
// Only add the suffixed version if the suffix exisits in the table.
|
||||
for (let idx in permArr) {
|
||||
let suffix = requestedSuffixes[idx % requestedSuffixes.length];
|
||||
if (tableEntry.access.indexOf(suffix) != -1) {
|
||||
@ -439,6 +428,8 @@ this.PermissionsInstaller = {
|
||||
if (!PermissionsTable[permName]) {
|
||||
Cu.reportError("PermissionsInstaller.jsm: '" + permName + "'" +
|
||||
" is not a valid Webapps permission type.");
|
||||
dump("PermissionsInstaller.jsm: '" + permName + "'" +
|
||||
" is not a valid Webapps permission type.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -452,7 +443,7 @@ this.PermissionsInstaller = {
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
debug("Caught webapps install permissions error");
|
||||
dump("Caught webapps install permissions error for " + aApp.origin);
|
||||
Cu.reportError(ex);
|
||||
if (aOnError) {
|
||||
aOnError();
|
||||
|
@ -3,6 +3,9 @@
|
||||
* 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 nsDOMWindowUtils_h_
|
||||
#define nsDOMWindowUtils_h_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
@ -48,3 +51,5 @@ protected:
|
||||
|
||||
static mozilla::widget::Modifiers GetWidgetModifiers(int32_t aModifiers);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -231,7 +231,7 @@ function checkContacts(contact1, contact2) {
|
||||
var req;
|
||||
var index = 0;
|
||||
|
||||
var mozContacts = window.navigator.mozContacts
|
||||
var mozContacts = window.navigator.mozContacts;
|
||||
|
||||
var steps = [
|
||||
function () {
|
||||
|
@ -213,6 +213,9 @@ DeviceStorageTypeChecker::GetAccessForRequest(const DeviceStorageRequestType aRe
|
||||
case DEVICE_STORAGE_REQUEST_DELETE:
|
||||
aAccessResult.AssignLiteral("write");
|
||||
break;
|
||||
case DEVICE_STORAGE_REQUEST_CREATE:
|
||||
aAccessResult.AssignLiteral("create");
|
||||
break;
|
||||
default:
|
||||
aAccessResult.AssignLiteral("undefined");
|
||||
}
|
||||
@ -1553,7 +1556,7 @@ public:
|
||||
}
|
||||
|
||||
switch(mRequestType) {
|
||||
case DEVICE_STORAGE_REQUEST_WRITE:
|
||||
case DEVICE_STORAGE_REQUEST_CREATE:
|
||||
{
|
||||
if (!mBlob) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1581,6 +1584,7 @@ public:
|
||||
}
|
||||
|
||||
case DEVICE_STORAGE_REQUEST_READ:
|
||||
case DEVICE_STORAGE_REQUEST_WRITE:
|
||||
{
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
PDeviceStorageRequestChild* child = new DeviceStorageRequestChild(mRequest, mFile);
|
||||
@ -1846,7 +1850,7 @@ nsDOMDeviceStorage::AddNamed(nsIDOMBlob *aBlob,
|
||||
r = new PostErrorEvent(request, POST_ERROR_EVENT_ILLEGAL_TYPE);
|
||||
}
|
||||
else {
|
||||
r = new DeviceStorageRequest(DEVICE_STORAGE_REQUEST_WRITE,
|
||||
r = new DeviceStorageRequest(DEVICE_STORAGE_REQUEST_CREATE,
|
||||
win, mPrincipal, dsf, request, aBlob);
|
||||
}
|
||||
|
||||
@ -1899,7 +1903,7 @@ nsDOMDeviceStorage::GetInternal(const JS::Value & aPath,
|
||||
if (!dsf->IsSafePath()) {
|
||||
r = new PostErrorEvent(request, POST_ERROR_EVENT_PERMISSION_DENIED);
|
||||
} else {
|
||||
r = new DeviceStorageRequest(DEVICE_STORAGE_REQUEST_READ,
|
||||
r = new DeviceStorageRequest(aEditable ? DEVICE_STORAGE_REQUEST_WRITE : DEVICE_STORAGE_REQUEST_READ,
|
||||
win, mPrincipal, dsf, request);
|
||||
}
|
||||
NS_DispatchToMainThread(r);
|
||||
|
@ -42,6 +42,7 @@ class nsPIDOMWindow;
|
||||
enum DeviceStorageRequestType {
|
||||
DEVICE_STORAGE_REQUEST_READ,
|
||||
DEVICE_STORAGE_REQUEST_WRITE,
|
||||
DEVICE_STORAGE_REQUEST_CREATE,
|
||||
DEVICE_STORAGE_REQUEST_DELETE,
|
||||
DEVICE_STORAGE_REQUEST_WATCH,
|
||||
DEVICE_STORAGE_REQUEST_STAT
|
||||
|
@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=2 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/AudioChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
NS_IMPL_THREADSAFE_ADDREF(AudioChild);
|
||||
NS_IMPL_THREADSAFE_RELEASE(AudioChild);
|
||||
|
||||
AudioChild::AudioChild()
|
||||
: mLastPosition(-1),
|
||||
mLastPositionTimestamp(0),
|
||||
mWriteCounter(0),
|
||||
mMinWriteSize(-2),// Initial value, -2, error on -1
|
||||
mAudioReentrantMonitor("AudioChild.mReentrantMonitor"),
|
||||
mIPCOpen(true),
|
||||
mDrained(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(AudioChild);
|
||||
}
|
||||
|
||||
AudioChild::~AudioChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(AudioChild);
|
||||
}
|
||||
|
||||
void
|
||||
AudioChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
mIPCOpen = false;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioChild::RecvPositionInFramesUpdate(const int64_t& position,
|
||||
const int64_t& time)
|
||||
{
|
||||
mLastPosition = position;
|
||||
mLastPositionTimestamp = time;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioChild::RecvDrainDone()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
mDrained = true;
|
||||
mAudioReentrantMonitor.NotifyAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t
|
||||
AudioChild::WaitForMinWriteSize()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
// -2 : initial value
|
||||
while (mMinWriteSize == -2 && mIPCOpen) {
|
||||
mAudioReentrantMonitor.Wait();
|
||||
}
|
||||
return mMinWriteSize;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioChild::RecvMinWriteSizeDone(const int32_t& minFrames)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
mMinWriteSize = minFrames;
|
||||
mAudioReentrantMonitor.NotifyAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AudioChild::WaitForDrain()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
while (!mDrained && mIPCOpen) {
|
||||
mAudioReentrantMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AudioChild::RecvWriteDone()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
mWriteCounter += 1;
|
||||
mAudioReentrantMonitor.NotifyAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AudioChild::WaitForWrite()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
|
||||
uint64_t writeCounter = mWriteCounter;
|
||||
while (mWriteCounter == writeCounter && mIPCOpen) {
|
||||
mAudioReentrantMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t
|
||||
AudioChild::GetLastKnownPosition()
|
||||
{
|
||||
return mLastPosition;
|
||||
}
|
||||
|
||||
int64_t
|
||||
AudioChild::GetLastKnownPositionTimestamp()
|
||||
{
|
||||
return mLastPositionTimestamp;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_AudioChild_h
|
||||
#define mozilla_dom_AudioChild_h
|
||||
|
||||
#include "mozilla/dom/PAudioChild.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class AudioChild : public PAudioChild
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
|
||||
AudioChild();
|
||||
virtual ~AudioChild();
|
||||
virtual bool RecvPositionInFramesUpdate(const int64_t&, const int64_t&);
|
||||
virtual bool RecvDrainDone();
|
||||
virtual int32_t WaitForMinWriteSize();
|
||||
virtual bool RecvMinWriteSizeDone(const int32_t& frameCount);
|
||||
virtual void WaitForDrain();
|
||||
virtual bool RecvWriteDone();
|
||||
virtual void WaitForWrite();
|
||||
virtual void ActorDestroy(ActorDestroyReason);
|
||||
|
||||
int64_t GetLastKnownPosition();
|
||||
int64_t GetLastKnownPositionTimestamp();
|
||||
|
||||
bool IsIPCOpen() { return mIPCOpen; };
|
||||
private:
|
||||
nsAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
int64_t mLastPosition;
|
||||
int64_t mLastPositionTimestamp;
|
||||
uint64_t mWriteCounter;
|
||||
int32_t mMinWriteSize;
|
||||
mozilla::ReentrantMonitor mAudioReentrantMonitor;
|
||||
bool mIPCOpen;
|
||||
bool mDrained;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -1,341 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/AudioParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "AudioChannelCommon.h"
|
||||
|
||||
// C++ file contents
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class AudioWriteDoneEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioWriteDoneEvent(AudioParent* owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->SendWriteDone();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioParent> mOwner;
|
||||
};
|
||||
|
||||
class AudioWriteEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioWriteEvent(AudioParent* parent, AudioStream* owner, nsCString data, uint32_t frames)
|
||||
{
|
||||
mParent = parent;
|
||||
mOwner = owner;
|
||||
mData = data;
|
||||
mFrames = frames;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->Write(reinterpret_cast<const AudioDataValue*>(mData.get()), mFrames);
|
||||
nsCOMPtr<nsIRunnable> event = new AudioWriteDoneEvent(mParent);
|
||||
NS_DispatchToMainThread(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioParent> mParent;
|
||||
nsRefPtr<AudioStream> mOwner;
|
||||
nsCString mData;
|
||||
uint32_t mFrames;
|
||||
};
|
||||
|
||||
class AudioPauseEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioPauseEvent(AudioStream* owner, bool aPause)
|
||||
{
|
||||
mOwner = owner;
|
||||
mPause = aPause;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
if (mPause)
|
||||
mOwner->Pause();
|
||||
else
|
||||
mOwner->Resume();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioStream> mOwner;
|
||||
bool mPause;
|
||||
};
|
||||
|
||||
class AudioStreamShutdownEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioStreamShutdownEvent(AudioStream* owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->Shutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioStream> mOwner;
|
||||
};
|
||||
|
||||
|
||||
class AudioMinWriteSizeDone : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioMinWriteSizeDone(AudioParent* owner, int32_t minFrames)
|
||||
{
|
||||
mOwner = owner;
|
||||
mMinFrames = minFrames;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->SendMinWriteSizeDone(mMinFrames);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioParent> mOwner;
|
||||
int32_t mMinFrames;
|
||||
};
|
||||
|
||||
class AudioMinWriteSizeEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioMinWriteSizeEvent(AudioParent* parent, AudioStream* owner)
|
||||
{
|
||||
mParent = parent;
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
int32_t minFrames = mOwner->GetMinWriteSize();
|
||||
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeDone(mParent, minFrames);
|
||||
NS_DispatchToMainThread(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioStream> mOwner;
|
||||
nsRefPtr<AudioParent> mParent;
|
||||
};
|
||||
|
||||
class AudioDrainDoneEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioDrainDoneEvent(AudioParent* owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->SendDrainDone();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioParent> mOwner;
|
||||
};
|
||||
|
||||
class AudioDrainEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AudioDrainEvent(AudioParent* parent, AudioStream* owner)
|
||||
{
|
||||
mParent = parent;
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mOwner->Drain();
|
||||
nsCOMPtr<nsIRunnable> event = new AudioDrainDoneEvent(mParent);
|
||||
NS_DispatchToMainThread(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioStream> mOwner;
|
||||
nsRefPtr<AudioParent> mParent;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(AudioParent, nsITimerCallback)
|
||||
|
||||
nsresult
|
||||
AudioParent::Notify(nsITimer* timer)
|
||||
{
|
||||
if (!mIPCOpen) {
|
||||
timer->Cancel();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mStream, "AudioStream not initialized.");
|
||||
int64_t position = mStream->GetPositionInFrames();
|
||||
unused << SendPositionInFramesUpdate(position, PR_IntervalNow());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvWrite(const nsCString& data, const uint32_t& frames)
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioWriteEvent(this, mStream, data, frames);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvSetVolume(const float& aVolume)
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
mStream->SetVolume(aVolume);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvMinWriteSize()
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSizeEvent(this, mStream);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvDrain()
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioDrainEvent(this, mStream);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvPause()
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mStream, true);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvResume()
|
||||
{
|
||||
if (!mStream)
|
||||
return false;
|
||||
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mStream, false);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::RecvShutdown()
|
||||
{
|
||||
Shutdown();
|
||||
unused << PAudioParent::Send__delete__(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::SendMinWriteSizeDone(int32_t minFrames)
|
||||
{
|
||||
if (mIPCOpen)
|
||||
return PAudioParent::SendMinWriteSizeDone(minFrames);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::SendDrainDone()
|
||||
{
|
||||
if (mIPCOpen)
|
||||
return PAudioParent::SendDrainDone();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioParent::SendWriteDone()
|
||||
{
|
||||
if (mIPCOpen)
|
||||
return PAudioParent::SendWriteDone();
|
||||
return true;
|
||||
}
|
||||
|
||||
AudioParent::AudioParent(int32_t aNumChannels, int32_t aRate)
|
||||
: mIPCOpen(true)
|
||||
{
|
||||
mStream = AudioStream::AllocateStream();
|
||||
NS_ASSERTION(mStream, "AudioStream allocation failed.");
|
||||
|
||||
if (NS_FAILED(mStream->Init(aNumChannels, aRate, AUDIO_CHANNEL_NORMAL))) {
|
||||
NS_WARNING("AudioStream initialization failed.");
|
||||
mStream = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mTimer->InitWithCallback(this, 1000, nsITimer::TYPE_REPEATING_SLACK);
|
||||
}
|
||||
|
||||
AudioParent::~AudioParent()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AudioParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
mIPCOpen = false;
|
||||
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
AudioParent::Shutdown()
|
||||
{
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
mTimer = nullptr;
|
||||
}
|
||||
|
||||
if (mStream) {
|
||||
nsCOMPtr<nsIRunnable> event = new AudioStreamShutdownEvent(mStream);
|
||||
nsCOMPtr<nsIThread> thread = mStream->GetThread();
|
||||
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
mStream = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_AudioParent_h
|
||||
#define mozilla_dom_AudioParent_h
|
||||
|
||||
#include "mozilla/dom/PAudioParent.h"
|
||||
#include "AudioStream.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class AudioParent : public PAudioParent, public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
virtual bool
|
||||
RecvWrite(const nsCString& data, const uint32_t& count);
|
||||
|
||||
virtual bool
|
||||
RecvSetVolume(const float& aVolume);
|
||||
|
||||
virtual bool
|
||||
RecvMinWriteSize();
|
||||
|
||||
virtual bool
|
||||
RecvDrain();
|
||||
|
||||
virtual bool
|
||||
RecvPause();
|
||||
|
||||
virtual bool
|
||||
RecvResume();
|
||||
|
||||
virtual bool
|
||||
RecvShutdown();
|
||||
|
||||
virtual bool
|
||||
SendMinWriteSizeDone(int32_t minFrames);
|
||||
|
||||
virtual bool
|
||||
SendDrainDone();
|
||||
|
||||
virtual bool
|
||||
SendWriteDone();
|
||||
|
||||
AudioParent(int32_t aNumChannels, int32_t aRate);
|
||||
virtual ~AudioParent();
|
||||
virtual void ActorDestroy(ActorDestroyReason);
|
||||
|
||||
nsRefPtr<AudioStream> mStream;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
|
||||
private:
|
||||
void Shutdown();
|
||||
|
||||
bool mIPCOpen;
|
||||
};
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -15,9 +15,6 @@
|
||||
#include "ContentChild.h"
|
||||
#include "CrashReporterChild.h"
|
||||
#include "TabChild.h"
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
#include "AudioChild.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ExternalHelperAppChild.h"
|
||||
@ -34,9 +31,6 @@
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
#include "AudioStream.h"
|
||||
#endif
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIMemoryInfoDumper.h"
|
||||
#include "nsIObserverService.h"
|
||||
@ -662,29 +656,6 @@ ContentChild::RecvPTestShellConstructor(PTestShellChild* actor)
|
||||
return true;
|
||||
}
|
||||
|
||||
PAudioChild*
|
||||
ContentChild::AllocPAudio(const int32_t& numChannels,
|
||||
const int32_t& rate)
|
||||
{
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
AudioChild *child = new AudioChild();
|
||||
NS_ADDREF(child);
|
||||
return child;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPAudio(PAudioChild* doomed)
|
||||
{
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
AudioChild *child = static_cast<AudioChild*>(doomed);
|
||||
NS_RELEASE(child);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
PDeviceStorageRequestChild*
|
||||
ContentChild::AllocPDeviceStorageRequest(const DeviceStorageParams& aParams)
|
||||
{
|
||||
|
@ -123,10 +123,6 @@ public:
|
||||
virtual bool DeallocPTestShell(PTestShellChild*);
|
||||
virtual bool RecvPTestShellConstructor(PTestShellChild*);
|
||||
|
||||
virtual PAudioChild* AllocPAudio(const int32_t&,
|
||||
const int32_t&);
|
||||
virtual bool DeallocPAudio(PAudioChild*);
|
||||
|
||||
virtual PNeckoChild* AllocPNecko();
|
||||
virtual bool DeallocPNecko(PNeckoChild*);
|
||||
|
||||
|
@ -92,10 +92,6 @@
|
||||
# include "nsPermissionManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SYDNEYAUDIO
|
||||
# include "AudioParent.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
# include "AndroidBridge.h"
|
||||
#endif
|
||||
@ -1442,29 +1438,6 @@ ContentParent::DeallocPTestShell(PTestShellParent* shell)
|
||||
return true;
|
||||
}
|
||||
|
||||
PAudioParent*
|
||||
ContentParent::AllocPAudio(const int32_t& numChannels,
|
||||
const int32_t& rate)
|
||||
{
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
AudioParent *parent = new AudioParent(numChannels, rate);
|
||||
NS_ADDREF(parent);
|
||||
return parent;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DeallocPAudio(PAudioParent* doomed)
|
||||
{
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
AudioParent *parent = static_cast<AudioParent*>(doomed);
|
||||
NS_RELEASE(parent);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
PNeckoParent*
|
||||
ContentParent::AllocPNecko()
|
||||
{
|
||||
|
@ -217,10 +217,6 @@ private:
|
||||
virtual PTestShellParent* AllocPTestShell();
|
||||
virtual bool DeallocPTestShell(PTestShellParent* shell);
|
||||
|
||||
virtual PAudioParent* AllocPAudio(const int32_t&,
|
||||
const int32_t&);
|
||||
virtual bool DeallocPAudio(PAudioParent*);
|
||||
|
||||
virtual PNeckoParent* AllocPNecko();
|
||||
virtual bool DeallocPNecko(PNeckoParent* necko);
|
||||
|
||||
|
@ -69,17 +69,6 @@ CPPSRCS = \
|
||||
TabMessageUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_SYDNEYAUDIO
|
||||
EXPORTS_mozilla/dom += \
|
||||
AudioChild.h \
|
||||
AudioParent.h \
|
||||
$(NULL)
|
||||
CPPSRCS += \
|
||||
AudioChild.cpp \
|
||||
AudioParent.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PContent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
protocol PAudio
|
||||
{
|
||||
manager PContent;
|
||||
|
||||
parent:
|
||||
|
||||
Write(nsCString data, uint32_t frames);
|
||||
|
||||
SetVolume(float aVolume);
|
||||
|
||||
MinWriteSize();
|
||||
Drain();
|
||||
|
||||
Pause();
|
||||
Resume();
|
||||
Shutdown();
|
||||
|
||||
child:
|
||||
|
||||
__delete__();
|
||||
|
||||
PositionInFramesUpdate(int64_t position, int64_t time);
|
||||
MinWriteSizeDone(int32_t frameCount);
|
||||
DrainDone();
|
||||
WriteDone();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -4,7 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PAudio;
|
||||
include protocol PBlob;
|
||||
include protocol PBluetooth;
|
||||
include protocol PBrowser;
|
||||
@ -213,7 +212,6 @@ rpc protocol PContent
|
||||
parent opens PCompositor;
|
||||
parent opens PImageBridge;
|
||||
|
||||
manages PAudio;
|
||||
manages PBlob;
|
||||
manages PBluetooth;
|
||||
manages PBrowser;
|
||||
@ -335,8 +333,6 @@ parent:
|
||||
sync GetXPCOMProcessAttributes()
|
||||
returns (bool isOffline);
|
||||
|
||||
PAudio(int32_t aNumChannels, int32_t aRate);
|
||||
|
||||
PDeviceStorageRequest(DeviceStorageParams params);
|
||||
|
||||
sync PCrashReporter(NativeThreadId tid, uint32_t processType);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
IPDLSRCS = \
|
||||
DOMTypes.ipdlh \
|
||||
PAudio.ipdl \
|
||||
PBlob.ipdl \
|
||||
PBlobStream.ipdl \
|
||||
PBrowser.ipdl \
|
||||
|
@ -2,32 +2,25 @@ const Cu = Components.utils;
|
||||
const READWRITE = "readwrite";
|
||||
const UNKNOWN = "foobar";
|
||||
|
||||
/*
|
||||
* Remove "contacts" from first test expected array and
|
||||
* "settings" and "indexedDB-chrome-settings" from second
|
||||
* test when this is fixed
|
||||
* http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/PermissionsInstaller.jsm#316
|
||||
*/
|
||||
var gData = [
|
||||
// test normal expansion
|
||||
{
|
||||
permission: "contacts",
|
||||
access: READWRITE,
|
||||
expected: ["contacts", "contacts-read", "contacts-create",
|
||||
expected: ["contacts-read", "contacts-create",
|
||||
"contacts-write"]
|
||||
},
|
||||
// test additional expansion and access not having read+create+write
|
||||
{
|
||||
permission: "settings",
|
||||
access: READWRITE,
|
||||
expected: ["settings", "settings-read", "settings-write",
|
||||
"indexedDB-chrome-settings", "indexedDB-chrome-settings-read",
|
||||
expected: ["settings-read", "settings-write",
|
||||
"indexedDB-chrome-settings-read",
|
||||
"indexedDB-chrome-settings-write"]
|
||||
},
|
||||
// test substitute
|
||||
{
|
||||
permission: "storage",
|
||||
access: READWRITE,
|
||||
expected: ["indexedDB-unlimited", "offline-app", "pin-app"]
|
||||
},
|
||||
// test unknown access
|
||||
|
@ -12,7 +12,7 @@
|
||||
"@mozilla.org/plugin/host;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(fdb56ce3-89ac-4293-be64-9f4be88004cc)]
|
||||
[scriptable, uuid(d70af999-cb1f-4429-b85e-f18cdbabc43c)]
|
||||
interface nsIPluginHost : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -81,5 +81,7 @@ interface nsIPluginHost : nsISupports
|
||||
void registerPlayPreviewMimeType(in AUTF8String mimeType);
|
||||
|
||||
void unregisterPlayPreviewMimeType(in AUTF8String mimeType);
|
||||
|
||||
bool isPluginClickToPlayForType(in AUTF8String mimeType);
|
||||
};
|
||||
|
||||
|
@ -1762,8 +1762,14 @@ nsNPAPIPluginInstance::CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
|
||||
|
||||
nsRefPtr<nsPluginHost> pluginHost =
|
||||
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
|
||||
if (!pluginHost ||
|
||||
!pluginHost->IsPluginClickToPlayForType(mMIMEType)) {
|
||||
if (!pluginHost) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isClickToPlay;
|
||||
nsAutoCString mimeType(mMIMEType);
|
||||
rv = pluginHost->IsPluginClickToPlayForType(mimeType, &isClickToPlay);
|
||||
if (NS_FAILED(rv) || !isClickToPlay) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1295,17 +1295,28 @@ nsPluginHost::IsPluginEnabledForType(const char* aMimeType)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsPluginHost::IsPluginClickToPlayForType(const char* aMimeType)
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::IsPluginClickToPlayForType(const nsACString &aMimeType, bool *aResult)
|
||||
{
|
||||
nsPluginTag *plugin = FindPluginForType(aMimeType, true);
|
||||
if (plugin &&
|
||||
(plugin->HasFlag(NS_PLUGIN_FLAG_CLICKTOPLAY) || mPluginsClickToPlay)) {
|
||||
return true;
|
||||
nsPluginTag *plugin = FindPluginForType(aMimeType.Data(), true);
|
||||
if (!plugin) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
uint32_t blocklistState = nsIBlocklistService::STATE_NOT_BLOCKED;
|
||||
nsresult rv = GetBlocklistStateForType(aMimeType.Data(), &blocklistState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mPluginsClickToPlay ||
|
||||
blocklistState == nsIBlocklistService::STATE_VULNERABLE_NO_UPDATE ||
|
||||
blocklistState == nsIBlocklistService::STATE_VULNERABLE_UPDATE_AVAILABLE) {
|
||||
*aResult = true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
*aResult = false;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2154,10 +2165,6 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
if (state == nsIBlocklistService::STATE_OUTDATED && !seenBefore) {
|
||||
warnOutdated = true;
|
||||
}
|
||||
if (state == nsIBlocklistService::STATE_VULNERABLE_UPDATE_AVAILABLE ||
|
||||
state == nsIBlocklistService::STATE_VULNERABLE_NO_UPDATE) {
|
||||
pluginTag->Mark(NS_PLUGIN_FLAG_CLICKTOPLAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,6 @@ public:
|
||||
nsPluginInstanceOwner *aOwner);
|
||||
nsresult IsPluginEnabledForType(const char* aMimeType);
|
||||
nsresult IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
||||
bool IsPluginClickToPlayForType(const char *aMimeType);
|
||||
bool IsPluginPlayPreviewForType(const char *aMimeType);
|
||||
nsresult GetBlocklistStateForType(const char *aMimeType, uint32_t *state);
|
||||
|
||||
|
@ -2569,6 +2569,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
mInstance->HandleEvent(pluginEvent, nullptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
#endif
|
||||
|
@ -11,6 +11,8 @@ qemu = true
|
||||
[test_outgoing_delete.js]
|
||||
[test_getmessage.js]
|
||||
[test_getmessage_notfound.js]
|
||||
[test_filter_date.js]
|
||||
[test_filter_date_notfound.js]
|
||||
[test_filter_number_single.js]
|
||||
[test_filter_number_multiple.js]
|
||||
[test_filter_received.js]
|
||||
|
198
dom/sms/tests/marionette/test_filter_date.js
Normal file
198
dom/sms/tests/marionette/test_filter_date.js
Normal file
@ -0,0 +1,198 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 20000;
|
||||
|
||||
SpecialPowers.addPermission("sms", true, document);
|
||||
SpecialPowers.setBoolPref("dom.sms.enabled", true);
|
||||
|
||||
let sms = window.navigator.mozSms;
|
||||
let numberMsgs = 10;
|
||||
let smsList = new Array();
|
||||
|
||||
function verifyInitialState() {
|
||||
log("Verifying initial state.");
|
||||
ok(sms, "mozSms");
|
||||
// Ensure test is starting clean with no existing sms messages
|
||||
deleteAllMsgs(simulateIncomingSms);
|
||||
}
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let request = sms.getMessages(filter, false);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
ok(event.target.result, "smsrequest event.target.result");
|
||||
cursor = event.target.result;
|
||||
// Check if message was found
|
||||
if (cursor.message) {
|
||||
msgList.push(cursor.message.id);
|
||||
// Now get next message in the list
|
||||
cursor.continue();
|
||||
} else {
|
||||
// No (more) messages found
|
||||
if (msgList.length) {
|
||||
log("Found " + msgList.length + " SMS messages to delete.");
|
||||
deleteMsgs(msgList, nextFunction);
|
||||
} else {
|
||||
log("No SMS messages found.");
|
||||
nextFunction();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
log("sms.getMessages error: " + event.target.error.name);
|
||||
ok(false,"Could not get SMS messages");
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function deleteMsgs(msgList, nextFunction) {
|
||||
let smsId = msgList.shift();
|
||||
|
||||
log("Deleting SMS (id: " + smsId + ").");
|
||||
let request = sms.delete(smsId);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
log("Received 'onsuccess' smsrequest event.");
|
||||
if (event.target.result) {
|
||||
// Message deleted, continue until none are left
|
||||
if (msgList.length) {
|
||||
deleteMsgs(msgList, nextFunction);
|
||||
} else {
|
||||
log("Finished deleting SMS messages.");
|
||||
nextFunction();
|
||||
}
|
||||
} else {
|
||||
log("SMS delete failed.");
|
||||
ok(false,"sms.delete request returned false");
|
||||
cleanUp();
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
ok(false, "sms.delete request returned unexpected error: "
|
||||
+ event.target.error.name );
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function simulateIncomingSms() {
|
||||
let text = "Incoming SMS number " + (smsList.length + 1);
|
||||
let remoteNumber = "5552229797";
|
||||
|
||||
log("Simulating incoming SMS number " + (smsList.length + 1) + " of "
|
||||
+ numberMsgs + ".");
|
||||
|
||||
// Simulate incoming sms sent from remoteNumber to our emulator
|
||||
rcvdEmulatorCallback = false;
|
||||
runEmulatorCmd("sms send " + remoteNumber + " " + text, function(result) {
|
||||
is(result[0], "OK", "emulator callback");
|
||||
rcvdEmulatorCallback = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Callback for incoming sms
|
||||
sms.onreceived = function onreceived(event) {
|
||||
log("Received 'onreceived' sms event.");
|
||||
let incomingSms = event.message;
|
||||
log("Received SMS (id: " + incomingSms.id + ").");
|
||||
|
||||
smsList.push(incomingSms);
|
||||
|
||||
// Wait for emulator to catch up before continuing
|
||||
waitFor(nextRep,function() {
|
||||
return(rcvdEmulatorCallback);
|
||||
});
|
||||
};
|
||||
|
||||
function nextRep() {
|
||||
if (smsList.length < numberMsgs) {
|
||||
simulateIncomingSms();
|
||||
} else {
|
||||
// Now test the filter
|
||||
getMsgs();
|
||||
}
|
||||
}
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for start date yesterday and end date tomorrow
|
||||
let yesterday = new Date(Date.now() - 86400000); // 24 hours = 86400000 ms
|
||||
let tomorrow = new Date(Date.now() + 86400000);
|
||||
filter.startDate = yesterday;
|
||||
filter.endDate = tomorrow;
|
||||
|
||||
log("Getting SMS messages with dates between " + yesterday + " and "
|
||||
+ tomorrow +".");
|
||||
let request = sms.getMessages(filter, false);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
log("Received 'onsuccess' smsrequest event.");
|
||||
ok(event.target.result, "smsrequest event.target.result");
|
||||
cursor = event.target.result;
|
||||
|
||||
if (cursor.message) {
|
||||
// Another message found
|
||||
log("Got SMS (id: " + cursor.message.id + ").");
|
||||
// Store found message
|
||||
foundSmsList.push(cursor.message);
|
||||
// Now get next message in the list
|
||||
cursor.continue();
|
||||
} else {
|
||||
// No more messages; ensure correct number found
|
||||
if (foundSmsList.length == smsList.length) {
|
||||
log("SMS getMessages returned " + foundSmsList.length +
|
||||
" messages as expected.");
|
||||
verifyFoundMsgs(foundSmsList);
|
||||
} else {
|
||||
log("SMS getMessages returned " + foundSmsList.length +
|
||||
" messages, but expected " + smsList.length + ".");
|
||||
ok(false, "Incorrect number of messages returned by sms.getMessages");
|
||||
deleteAllMsgs(cleanUp);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
log("sms.getMessages error: " + event.target.error.name);
|
||||
ok(false,"Could not get SMS messages");
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function verifyFoundMsgs(foundSmsList) {
|
||||
for (var x = 0; x < foundSmsList.length; x++) {
|
||||
is(foundSmsList[x].id, smsList[x].id, "id");
|
||||
is(foundSmsList[x].timestamp.getTime(), smsList[x].timestamp.getTime(),
|
||||
"timestmap");
|
||||
}
|
||||
deleteAllMsgs(cleanUp);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
sms.onreceived = null;
|
||||
SpecialPowers.removePermission("sms", document);
|
||||
SpecialPowers.clearUserPref("dom.sms.enabled");
|
||||
finish();
|
||||
}
|
||||
|
||||
// Start the test
|
||||
verifyInitialState();
|
179
dom/sms/tests/marionette/test_filter_date_notfound.js
Normal file
179
dom/sms/tests/marionette/test_filter_date_notfound.js
Normal file
@ -0,0 +1,179 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 20000;
|
||||
|
||||
SpecialPowers.addPermission("sms", true, document);
|
||||
SpecialPowers.setBoolPref("dom.sms.enabled", true);
|
||||
|
||||
let sms = window.navigator.mozSms;
|
||||
let numberMsgs = 10;
|
||||
let smsList = new Array();
|
||||
|
||||
function verifyInitialState() {
|
||||
log("Verifying initial state.");
|
||||
ok(sms, "mozSms");
|
||||
// Ensure test is starting clean with no existing sms messages
|
||||
deleteAllMsgs(simulateIncomingSms);
|
||||
}
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let request = sms.getMessages(filter, false);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
ok(event.target.result, "smsrequest event.target.result");
|
||||
cursor = event.target.result;
|
||||
// Check if message was found
|
||||
if (cursor.message) {
|
||||
msgList.push(cursor.message.id);
|
||||
// Now get next message in the list
|
||||
cursor.continue();
|
||||
} else {
|
||||
// No (more) messages found
|
||||
if (msgList.length) {
|
||||
log("Found " + msgList.length + " SMS messages to delete.");
|
||||
deleteMsgs(msgList, nextFunction);
|
||||
} else {
|
||||
log("No SMS messages found.");
|
||||
nextFunction();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
log("sms.getMessages error: " + event.target.error.name);
|
||||
ok(false,"Could not get SMS messages");
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function deleteMsgs(msgList, nextFunction) {
|
||||
let smsId = msgList.shift();
|
||||
|
||||
log("Deleting SMS (id: " + smsId + ").");
|
||||
let request = sms.delete(smsId);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
log("Received 'onsuccess' smsrequest event.");
|
||||
if (event.target.result) {
|
||||
// Message deleted, continue until none are left
|
||||
if (msgList.length) {
|
||||
deleteMsgs(msgList, nextFunction);
|
||||
} else {
|
||||
log("Finished deleting SMS messages.");
|
||||
nextFunction();
|
||||
}
|
||||
} else {
|
||||
log("SMS delete failed.");
|
||||
ok(false,"sms.delete request returned false");
|
||||
cleanUp();
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
ok(false, "sms.delete request returned unexpected error: "
|
||||
+ event.target.error.name );
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function simulateIncomingSms() {
|
||||
let text = "Incoming SMS number " + (smsList.length + 1);
|
||||
let remoteNumber = "5552229797";
|
||||
|
||||
log("Simulating incoming SMS number " + (smsList.length + 1) + " of "
|
||||
+ numberMsgs + ".");
|
||||
|
||||
// Simulate incoming sms sent from remoteNumber to our emulator
|
||||
rcvdEmulatorCallback = false;
|
||||
runEmulatorCmd("sms send " + remoteNumber + " " + text, function(result) {
|
||||
is(result[0], "OK", "emulator callback");
|
||||
rcvdEmulatorCallback = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Callback for incoming sms
|
||||
sms.onreceived = function onreceived(event) {
|
||||
log("Received 'onreceived' sms event.");
|
||||
let incomingSms = event.message;
|
||||
log("Received SMS (id: " + incomingSms.id + ").");
|
||||
|
||||
smsList.push(incomingSms);
|
||||
|
||||
// Wait for emulator to catch up before continuing
|
||||
waitFor(nextRep,function() {
|
||||
return(rcvdEmulatorCallback);
|
||||
});
|
||||
};
|
||||
|
||||
function nextRep() {
|
||||
if (smsList.length < numberMsgs) {
|
||||
simulateIncomingSms();
|
||||
} else {
|
||||
// Now test the filter
|
||||
getMsgs();
|
||||
}
|
||||
}
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for start date 2 days ago and end date yesterday (so 0 found)
|
||||
let yesterday = new Date(Date.now() - 86400000); // 24 hours = 86400000 ms
|
||||
let twoDaysAgo = new Date(Date.now() - 172800000);
|
||||
filter.startDate = twoDaysAgo;
|
||||
filter.endDate = yesterday;
|
||||
|
||||
log("Getting SMS messages with dates between " + twoDaysAgo + " and "
|
||||
+ yesterday +".");
|
||||
let request = sms.getMessages(filter, false);
|
||||
ok(request instanceof MozSmsRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
log("Received 'onsuccess' smsrequest event.");
|
||||
ok(event.target.result, "smsrequest event.target.result");
|
||||
cursor = event.target.result;
|
||||
|
||||
if (cursor.message) {
|
||||
// Another message found
|
||||
log("Got SMS (id: " + cursor.message.id + ").");
|
||||
log("SMS getMessages returned a message but should not have.");
|
||||
ok(false, "SMS date filter did not work");
|
||||
} else {
|
||||
// No messages found as expected
|
||||
log("SMS getMessages returned zero messages as expected.");
|
||||
}
|
||||
deleteAllMsgs(cleanUp);
|
||||
};
|
||||
|
||||
request.onerror = function(event) {
|
||||
log("Received 'onerror' smsrequest event.");
|
||||
ok(event.target.error, "domerror obj");
|
||||
log("sms.getMessages error: " + event.target.error.name);
|
||||
ok(false,"Could not get SMS messages");
|
||||
cleanUp();
|
||||
};
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
sms.onreceived = null;
|
||||
SpecialPowers.removePermission("sms", document);
|
||||
SpecialPowers.clearUserPref("dom.sms.enabled");
|
||||
finish();
|
||||
}
|
||||
|
||||
// Start the test
|
||||
verifyInitialState();
|
@ -109,7 +109,7 @@ nsDOMDesktopNotification::Init()
|
||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||
nsRefPtr<nsDesktopNotificationRequest> copy = request;
|
||||
|
||||
child->SendPContentPermissionRequestConstructor(request,
|
||||
child->SendPContentPermissionRequestConstructor(copy.forget().get(),
|
||||
NS_LITERAL_CSTRING("desktop-notification"),
|
||||
NS_LITERAL_CSTRING("unused"),
|
||||
IPC::Principal(mPrincipal));
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "base/message_loop.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsString.h"
|
||||
@ -285,7 +286,7 @@ private:
|
||||
VolumeArray mAutoVolume;
|
||||
};
|
||||
|
||||
static RefPtr<AutoMounter> sAutoMounter;
|
||||
static StaticRefPtr<AutoMounter> sAutoMounter;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
@ -524,8 +525,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static RefPtr<UsbCableObserver> sUsbCableObserver;
|
||||
static RefPtr<AutoMounterSetting> sAutoMounterSetting;
|
||||
static StaticRefPtr<UsbCableObserver> sUsbCableObserver;
|
||||
static StaticRefPtr<AutoMounterSetting> sAutoMounterSetting;
|
||||
|
||||
void
|
||||
InitAutoMounter()
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
// Set the system timezone based on the current settings.
|
||||
if (aResult.isString()) {
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(aResult));
|
||||
JSAutoCompartment ac(cx, aResult.toString());
|
||||
return TimeZoneSettingObserver::SetTimeZone(aResult, cx);
|
||||
}
|
||||
|
||||
|
@ -27,15 +27,17 @@ const TEST_ORIGIN_URL = "http://mochi.test:8888";
|
||||
const installedPermsToTest = {
|
||||
"geolocation": "prompt",
|
||||
"alarms": "allow",
|
||||
"contacts": "prompt",
|
||||
"device-storage:apps": "prompt",
|
||||
"contacts-write": "prompt",
|
||||
"contacts-read": "prompt",
|
||||
"device-storage:apps-read": "prompt",
|
||||
"device-storage:apps-write": "unknown"
|
||||
};
|
||||
|
||||
const uninstalledPermsToTest = {
|
||||
"geolocation": "unknown",
|
||||
"alarms": "unknown",
|
||||
"contacts": "unknown",
|
||||
"device-storage:apps": "unknown",
|
||||
"contacts-read": "unknown",
|
||||
"device-storage:apps-read": "unknown",
|
||||
};
|
||||
|
||||
var gWindow, gNavigator;
|
||||
@ -68,7 +70,7 @@ function test() {
|
||||
ok(nav.mozApps, "we have a mozApps property");
|
||||
var navMozPerms = nav.mozPermissionSettings;
|
||||
ok(navMozPerms, "mozPermissions is available");
|
||||
Math.sin(0);
|
||||
|
||||
// INSTALL app
|
||||
var pendingInstall = nav.mozApps.install(TEST_MANIFEST_URL, null);
|
||||
pendingInstall.onsuccess = function onsuccess()
|
||||
|
@ -10,10 +10,10 @@
|
||||
"description": "alarm"
|
||||
},
|
||||
"contacts": {
|
||||
"description": "contacts"
|
||||
"access": "readwrite"
|
||||
},
|
||||
"device-storage:apps": {
|
||||
"description": "storage"
|
||||
"access": "readonly"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ interface AudioBuffer {
|
||||
readonly attribute long length;
|
||||
|
||||
// in seconds
|
||||
readonly attribute float duration;
|
||||
readonly attribute double duration;
|
||||
|
||||
readonly attribute long numberOfChannels;
|
||||
|
||||
|
@ -28,10 +28,10 @@ interface mozAudioContext {
|
||||
|
||||
[Creator]
|
||||
GainNode createGain();
|
||||
// maxDelayTime should ideally be a restricted float to protect against
|
||||
// maxDelayTime should ideally be a restricted double to protect against
|
||||
// things such as NaNs.
|
||||
[Creator, Throws]
|
||||
DelayNode createDelay(optional float maxDelayTime = 1);
|
||||
DelayNode createDelay(optional double maxDelayTime = 1);
|
||||
[Creator]
|
||||
BiquadFilterNode createBiquadFilter();
|
||||
[Creator]
|
||||
|
@ -21,23 +21,23 @@ interface AudioParam {
|
||||
|
||||
// Parameter automation.
|
||||
[Throws]
|
||||
void setValueAtTime(float value, float startTime);
|
||||
void setValueAtTime(float value, double startTime);
|
||||
[Throws]
|
||||
void linearRampToValueAtTime(float value, float endTime);
|
||||
void linearRampToValueAtTime(float value, double endTime);
|
||||
[Throws]
|
||||
void exponentialRampToValueAtTime(float value, float endTime);
|
||||
void exponentialRampToValueAtTime(float value, double endTime);
|
||||
|
||||
// Exponentially approach the target value with a rate having the given time constant.
|
||||
[Throws]
|
||||
void setTargetAtTime(float target, float startTime, float timeConstant);
|
||||
void setTargetAtTime(float target, double startTime, double timeConstant);
|
||||
|
||||
// Sets an array of arbitrary parameter values starting at time for the given duration.
|
||||
// The number of values will be scaled to fit into the desired duration.
|
||||
// [Throws]
|
||||
// void setValueCurveAtTime(Float32Array values, float startTime, float duration);
|
||||
// void setValueCurveAtTime(Float32Array values, double startTime, double duration);
|
||||
|
||||
// Cancels all scheduled parameter changes with times greater than or equal to startTime.
|
||||
void cancelScheduledValues(float startTime);
|
||||
void cancelScheduledValues(double startTime);
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_MODULE_H
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
@ -27,9 +29,69 @@ static FT_Library gPlatformFTLibrary = NULL;
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoFonts" , ## args)
|
||||
|
||||
static int64_t sFreetypeMemoryUsed;
|
||||
static FT_MemoryRec_ sFreetypeMemoryRecord;
|
||||
|
||||
static int64_t
|
||||
GetFreetypeSize()
|
||||
{
|
||||
return sFreetypeMemoryUsed;
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_IMPLEMENT(Freetype,
|
||||
"explicit/freetype",
|
||||
KIND_HEAP,
|
||||
UNITS_BYTES,
|
||||
GetFreetypeSize,
|
||||
"Memory used by Freetype."
|
||||
)
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FreetypeMallocSizeOfForCounterInc, "freetype")
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN_UN(FreetypeMallocSizeOfForCounterDec)
|
||||
|
||||
static void*
|
||||
CountingAlloc(FT_Memory memory, long size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
sFreetypeMemoryUsed += FreetypeMallocSizeOfForCounterInc(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
CountingFree(FT_Memory memory, void* p)
|
||||
{
|
||||
sFreetypeMemoryUsed -= FreetypeMallocSizeOfForCounterDec(p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
static void*
|
||||
CountingRealloc(FT_Memory memory, long cur_size, long new_size, void* p)
|
||||
{
|
||||
sFreetypeMemoryUsed -= FreetypeMallocSizeOfForCounterDec(p);
|
||||
void *pnew = realloc(p, new_size);
|
||||
if (pnew) {
|
||||
sFreetypeMemoryUsed += FreetypeMallocSizeOfForCounterInc(pnew);
|
||||
} else {
|
||||
// realloc failed; undo the decrement from above
|
||||
sFreetypeMemoryUsed += FreetypeMallocSizeOfForCounterInc(p);
|
||||
}
|
||||
return pnew;
|
||||
}
|
||||
|
||||
gfxAndroidPlatform::gfxAndroidPlatform()
|
||||
{
|
||||
FT_Init_FreeType(&gPlatformFTLibrary);
|
||||
// A custom allocator. It counts allocations, enabling memory reporting.
|
||||
sFreetypeMemoryRecord.user = nullptr;
|
||||
sFreetypeMemoryRecord.alloc = CountingAlloc;
|
||||
sFreetypeMemoryRecord.free = CountingFree;
|
||||
sFreetypeMemoryRecord.realloc = CountingRealloc;
|
||||
|
||||
// These two calls are equivalent to FT_Init_FreeType(), but allow us to
|
||||
// provide a custom memory allocator.
|
||||
FT_New_Library(&sFreetypeMemoryRecord, &gPlatformFTLibrary);
|
||||
FT_Add_Default_Modules(gPlatformFTLibrary);
|
||||
|
||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(Freetype));
|
||||
|
||||
nsCOMPtr<nsIScreenManager> screenMgr = do_GetService("@mozilla.org/gfx/screenmanager;1");
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
@ -46,7 +108,7 @@ gfxAndroidPlatform::~gfxAndroidPlatform()
|
||||
{
|
||||
cairo_debug_reset_static_data();
|
||||
|
||||
FT_Done_FreeType(gPlatformFTLibrary);
|
||||
FT_Done_Library(gPlatformFTLibrary);
|
||||
gPlatformFTLibrary = NULL;
|
||||
}
|
||||
|
||||
|
@ -363,6 +363,16 @@ bool Channel::ChannelImpl::EnqueueHelloMessage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
ClearAndShrink(std::string& s, size_t capacity)
|
||||
{
|
||||
// This swap trick is the closest thing C++ has to a guaranteed way to
|
||||
// shrink the capacity of a string.
|
||||
std::string tmp;
|
||||
tmp.reserve(capacity);
|
||||
s.swap(tmp);
|
||||
}
|
||||
|
||||
bool Channel::ChannelImpl::Connect() {
|
||||
if (mode_ == MODE_SERVER && uses_fifo_) {
|
||||
if (server_listen_pipe_ == -1) {
|
||||
@ -489,7 +499,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
|
||||
} else {
|
||||
if (input_overflow_buf_.size() >
|
||||
static_cast<size_t>(kMaximumMessageSize - bytes_read)) {
|
||||
input_overflow_buf_.clear();
|
||||
ClearAndShrink(input_overflow_buf_, Channel::kReadBufferSize);
|
||||
LOG(ERROR) << "IPC message is too big";
|
||||
return false;
|
||||
}
|
||||
@ -573,7 +583,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
|
||||
}
|
||||
}
|
||||
if (end == p) {
|
||||
input_overflow_buf_.clear();
|
||||
ClearAndShrink(input_overflow_buf_, Channel::kReadBufferSize);
|
||||
} else if (!overflowp) {
|
||||
// p is from input_buf_
|
||||
input_overflow_buf_.assign(p, end - p);
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "ExecutableAllocator.h"
|
||||
|
||||
#if ENABLE_ASSEMBLER && WTF_OS_SYMBIAN
|
||||
|
||||
#include <e32hal.h>
|
||||
#include <e32std.h>
|
||||
|
||||
// Set the page size to 256 Kb to compensate for moving memory model limitation
|
||||
const size_t MOVING_MEM_PAGE_SIZE = 256 * 1024;
|
||||
|
||||
namespace JSC {
|
||||
|
||||
size_t ExecutableAllocator::determinePageSize()
|
||||
{
|
||||
#if WTF_CPU_ARMV5_OR_LOWER
|
||||
// The moving memory model (as used in ARMv5 and earlier platforms)
|
||||
// on Symbian OS limits the number of chunks for each process to 16.
|
||||
// To mitigate this limitation increase the pagesize to
|
||||
// allocate less of larger chunks.
|
||||
return MOVING_MEM_PAGE_SIZE;
|
||||
#else
|
||||
TInt page_size;
|
||||
UserHal::PageSizeInBytes(page_size);
|
||||
return page_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
ExecutablePool::Allocation ExecutableAllocator::systemAlloc(size_t n)
|
||||
{
|
||||
RChunk* codeChunk = new RChunk();
|
||||
|
||||
TInt errorCode = codeChunk->CreateLocalCode(n, n);
|
||||
|
||||
char* allocation = reinterpret_cast<char*>(codeChunk->Base());
|
||||
ExecutablePool::Allocation alloc = { allocation, n, codeChunk };
|
||||
return alloc;
|
||||
}
|
||||
|
||||
void ExecutableAllocator::systemRelease(const ExecutablePool::Allocation& alloc)
|
||||
{
|
||||
alloc.chunk->Close();
|
||||
delete alloc.chunk;
|
||||
}
|
||||
|
||||
#if ENABLE_ASSEMBLER_WX_EXCLUSIVE
|
||||
#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // HAVE(ASSEMBLER)
|
@ -204,6 +204,12 @@ IonCompartment::IonCompartment(IonRuntime *rt)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
IonCompartment::initialize(JSContext *cx)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ion::FinishOffThreadBuilder(IonBuilder *builder)
|
||||
{
|
||||
|
@ -100,6 +100,8 @@ class IonCompartment
|
||||
public:
|
||||
IonCompartment(IonRuntime *rt);
|
||||
|
||||
bool initialize(JSContext *cx);
|
||||
|
||||
void mark(JSTracer *trc, JSCompartment *compartment);
|
||||
void sweep(FreeOp *fop);
|
||||
|
||||
|
@ -1488,6 +1488,14 @@ JSAutoCompartment::JSAutoCompartment(JSContext *cx, JSStackFrame *target)
|
||||
cx_->enterCompartment(Valueify(target)->global().compartment());
|
||||
}
|
||||
|
||||
JSAutoCompartment::JSAutoCompartment(JSContext *cx, JSString *target)
|
||||
: cx_(cx),
|
||||
oldCompartment_(cx->compartment)
|
||||
{
|
||||
AssertHeapIsIdleOrIterating(cx_);
|
||||
cx_->enterCompartment(target->compartment());
|
||||
}
|
||||
|
||||
JSAutoCompartment::~JSAutoCompartment()
|
||||
{
|
||||
cx_->leaveCompartment(oldCompartment_);
|
||||
|
@ -3156,6 +3156,7 @@ class JS_PUBLIC_API(JSAutoCompartment)
|
||||
JSAutoCompartment(JSContext *cx, JSRawObject target);
|
||||
JSAutoCompartment(JSContext *cx, JSScript *target);
|
||||
JSAutoCompartment(JSContext *cx, JSStackFrame *target);
|
||||
JSAutoCompartment(JSContext *cx, JSString *target);
|
||||
~JSAutoCompartment();
|
||||
};
|
||||
|
||||
|
@ -196,6 +196,12 @@ JSCompartment::ensureIonCompartmentExists(JSContext *cx)
|
||||
if (!ionCompartment_)
|
||||
return false;
|
||||
|
||||
if (!ionCompartment_->initialize(cx)) {
|
||||
js_delete(ionCompartment_);
|
||||
ionCompartment_ = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -189,9 +189,7 @@ def parse_args():
|
||||
options.show = options.show_cmd or options.show_output
|
||||
|
||||
# Hide the progress bar if it will get in the way of other output.
|
||||
options.hide_progress = ((options.show and
|
||||
options.output_fp == sys.stdout) or
|
||||
options.tinderbox or
|
||||
options.hide_progress = (options.tinderbox or
|
||||
ProgressBar.conservative_isatty() or
|
||||
options.hide_progress)
|
||||
|
||||
|
@ -12,6 +12,7 @@ class NullProgressBar(object):
|
||||
def update(self, current, data): pass
|
||||
def poke(self): pass
|
||||
def finish(self, complete=True): pass
|
||||
def beginline(self): pass
|
||||
def message(self, msg): sys.stdout.write(msg + '\n')
|
||||
def update_granularity(self): return timedelta.max
|
||||
|
||||
@ -21,6 +22,7 @@ class ProgressBar(object):
|
||||
assert limit < 9999
|
||||
|
||||
self.prior = None
|
||||
self.atLineStart = True
|
||||
self.counters_fmt = fmt # [{str:str}] Describtion of how to lay out each
|
||||
# field in the counters map.
|
||||
self.limit = limit # int: The value of 'current' equal to 100%.
|
||||
@ -40,6 +42,7 @@ class ProgressBar(object):
|
||||
def update(self, current, data):
|
||||
# Record prior for poke.
|
||||
self.prior = (current, data)
|
||||
self.atLineStart = False
|
||||
|
||||
# Build counters string.
|
||||
sys.stdout.write('\r[')
|
||||
@ -79,8 +82,13 @@ class ProgressBar(object):
|
||||
self.update(final_count, self.prior[1])
|
||||
sys.stdout.write('\n')
|
||||
|
||||
def beginline(self):
|
||||
if not self.atLineStart:
|
||||
sys.stdout.write('\n')
|
||||
self.atLineStart = True
|
||||
|
||||
def message(self, msg):
|
||||
sys.stdout.write('\n')
|
||||
self.beginline()
|
||||
sys.stdout.write(msg)
|
||||
sys.stdout.write('\n')
|
||||
|
||||
|
@ -111,27 +111,29 @@ class ResultsSink:
|
||||
self.n += 1
|
||||
else:
|
||||
result = TestResult.from_output(output)
|
||||
|
||||
show = self.options.show
|
||||
if self.options.failed_only and result.result == 'PASS':
|
||||
show = False
|
||||
|
||||
if show and self.options.show_output:
|
||||
print >> self.fp, '## %s: rc = %d, run time = %f' % (output.test.path, output.rc, output.dt)
|
||||
|
||||
if show and self.options.show_cmd:
|
||||
print >> self.fp, escape_cmdline(output.cmd)
|
||||
|
||||
if show and self.options.show_output:
|
||||
self.fp.write(output.out)
|
||||
self.fp.write(output.err)
|
||||
|
||||
tup = (result.result, result.test.expect, result.test.random)
|
||||
dev_label = self.LABELS[tup][1]
|
||||
if output.timed_out:
|
||||
dev_label = 'TIMEOUTS'
|
||||
self.groups.setdefault(dev_label, []).append(result.test.path)
|
||||
|
||||
show = self.options.show
|
||||
if self.options.failed_only and dev_label not in ('REGRESSIONS', 'TIMEOUTS'):
|
||||
show = False
|
||||
if show:
|
||||
self.pb.beginline()
|
||||
|
||||
if show:
|
||||
if self.options.show_output:
|
||||
print >> self.fp, '## %s: rc = %d, run time = %f' % (output.test.path, output.rc, output.dt)
|
||||
|
||||
if self.options.show_cmd:
|
||||
print >> self.fp, escape_cmdline(output.cmd)
|
||||
|
||||
if self.options.show_output:
|
||||
self.fp.write(output.out)
|
||||
self.fp.write(output.err)
|
||||
|
||||
self.n += 1
|
||||
|
||||
if result.result == TestResult.PASS and not result.test.random:
|
||||
|
@ -377,7 +377,7 @@ interface nsIXPCComponents_Utils : nsISupports
|
||||
|
||||
[implicit_jscontext]
|
||||
attribute boolean strict_mode;
|
||||
|
||||
|
||||
[implicit_jscontext]
|
||||
attribute boolean ion;
|
||||
|
||||
|
@ -1124,12 +1124,48 @@ static int
|
||||
usage(void)
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-PsSwWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-PsSwWxCijmIn] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
extern JSClass global_class;
|
||||
|
||||
static void
|
||||
ProcessArgsForCompartment(JSContext *cx, char **argv, int argc)
|
||||
{
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (argv[i][0] != '-' || argv[i][1] == '\0')
|
||||
break;
|
||||
|
||||
switch (argv[i][1]) {
|
||||
case 'v':
|
||||
case 'f':
|
||||
case 'e':
|
||||
if (++i == argc)
|
||||
return;
|
||||
break;
|
||||
case 'S':
|
||||
JS_ToggleOptions(cx, JSOPTION_WERROR);
|
||||
case 's':
|
||||
JS_ToggleOptions(cx, JSOPTION_STRICT);
|
||||
break;
|
||||
case 'x':
|
||||
JS_ToggleOptions(cx, JSOPTION_MOAR_XML);
|
||||
break;
|
||||
case 'm':
|
||||
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
|
||||
break;
|
||||
case 'I':
|
||||
JS_ToggleOptions(cx, JSOPTION_COMPILE_N_GO);
|
||||
JS_ToggleOptions(cx, JSOPTION_ION);
|
||||
break;
|
||||
case 'n':
|
||||
JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
||||
{
|
||||
@ -1210,13 +1246,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
||||
case 'w':
|
||||
reportWarnings = true;
|
||||
break;
|
||||
case 'S':
|
||||
JS_ToggleOptions(cx, JSOPTION_WERROR);
|
||||
case 's':
|
||||
JS_ToggleOptions(cx, JSOPTION_STRICT);
|
||||
break;
|
||||
case 'x':
|
||||
JS_ToggleOptions(cx, JSOPTION_MOAR_XML);
|
||||
break;
|
||||
case 'd':
|
||||
xpc_ActivateDebugMode();
|
||||
@ -1254,11 +1284,12 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
||||
compileOnly = true;
|
||||
isInteractive = false;
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
case 'm':
|
||||
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
|
||||
break;
|
||||
case 'I':
|
||||
case 'n':
|
||||
JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE);
|
||||
// These options are processed in ProcessArgsForCompartment.
|
||||
break;
|
||||
default:
|
||||
return usage();
|
||||
@ -1775,6 +1806,10 @@ main(int argc, char **argv, char **envp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
ProcessArgsForCompartment(cx, argv, argc);
|
||||
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ALLOW_XML);
|
||||
xpc_LocalizeContext(cx);
|
||||
|
||||
@ -1887,9 +1922,6 @@ main(int argc, char **argv, char **envp)
|
||||
JS_DefineProperty(cx, glob, "__LOCATION__", JSVAL_VOID,
|
||||
GetLocationProperty, NULL, 0);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
result = ProcessArgs(cx, glob, argv, argc);
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ static EventRadiusPrefs sMouseEventRadiusPrefs;
|
||||
static EventRadiusPrefs sTouchEventRadiusPrefs;
|
||||
|
||||
static const EventRadiusPrefs*
|
||||
GetPrefsFor(uint8_t aEventStructType)
|
||||
GetPrefsFor(nsEventStructType aEventStructType)
|
||||
{
|
||||
EventRadiusPrefs* prefs = nullptr;
|
||||
const char* prefBranch = nullptr;
|
||||
@ -235,7 +235,7 @@ GetClosest(nsIFrame* aRoot, const nsPoint& aPointRelativeToRootFrame,
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
FindFrameTargetedByInputEvent(uint8_t aEventStructType,
|
||||
FindFrameTargetedByInputEvent(nsEventStructType aEventStructType,
|
||||
nsIFrame* aRootFrame,
|
||||
const nsPoint& aPointRelativeToRootFrame,
|
||||
uint32_t aFlags)
|
||||
|
@ -6,8 +6,8 @@
|
||||
#define mozilla_PositionedEventTargeting_h
|
||||
|
||||
#include "nsPoint.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
class nsGUIEvent;
|
||||
class nsIFrame;
|
||||
|
||||
namespace mozilla {
|
||||
@ -21,7 +21,7 @@ enum {
|
||||
* that are suitable targets, to account for inaccurate pointing devices.
|
||||
*/
|
||||
nsIFrame*
|
||||
FindFrameTargetedByInputEvent(uint8_t aEventStructType,
|
||||
FindFrameTargetedByInputEvent(nsEventStructType aEventStructType,
|
||||
nsIFrame* aRootFrame,
|
||||
const nsPoint& aPointRelativeToRootFrame,
|
||||
uint32_t aFlags = 0);
|
||||
|
@ -1061,7 +1061,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
|
||||
NotifySubDocInvalidationFunc computeInvalidFunc =
|
||||
presContext->MayHavePaintEventListenerInSubDocument() ? nsPresContext::NotifySubDocInvalidation : 0;
|
||||
bool computeInvalidRect = (computeInvalidFunc ||
|
||||
(layerManager->GetBackendType() == LAYERS_BASIC)) &&
|
||||
!layerManager->IsCompositingCheap()) &&
|
||||
widgetTransaction;
|
||||
|
||||
nsAutoPtr<LayerProperties> props(computeInvalidRect ?
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user