Merge m-c to graphics
MozReview-Commit-ID: C13IwWOpf64
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "AccessibleNode.h"
|
#include "AccessibleNode.h"
|
||||||
#include "mozilla/dom/AccessibleNodeBinding.h"
|
#include "mozilla/dom/AccessibleNodeBinding.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
|
#include "mozilla/dom/DOMStringList.h"
|
||||||
|
|
||||||
#include "Accessible-inl.h"
|
#include "Accessible-inl.h"
|
||||||
#include "nsAccessibilityService.h"
|
#include "nsAccessibilityService.h"
|
||||||
@@ -61,6 +62,20 @@ AccessibleNode::GetRole(nsAString& aRole)
|
|||||||
aRole.AssignLiteral("unknown");
|
aRole.AssignLiteral("unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AccessibleNode::GetStates(nsTArray<nsString>& aStates)
|
||||||
|
{
|
||||||
|
if (mIntl) {
|
||||||
|
if (!mStates) {
|
||||||
|
mStates = GetOrCreateAccService()->GetStringStates(mIntl->State());
|
||||||
|
}
|
||||||
|
aStates = mStates->StringArray();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mStates->Add(NS_LITERAL_STRING("defunct"));
|
||||||
|
}
|
||||||
|
|
||||||
nsINode*
|
nsINode*
|
||||||
AccessibleNode::GetDOMNode()
|
AccessibleNode::GetDOMNode()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
|
#include "nsTArray.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
class nsINode;
|
class nsINode;
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ namespace a11y {
|
|||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
class DOMStringList;
|
||||||
struct ParentObject;
|
struct ParentObject;
|
||||||
|
|
||||||
class AccessibleNode : public nsISupports,
|
class AccessibleNode : public nsISupports,
|
||||||
@@ -35,8 +38,11 @@ public:
|
|||||||
virtual dom::ParentObject GetParentObject() const final;
|
virtual dom::ParentObject GetParentObject() const final;
|
||||||
|
|
||||||
void GetRole(nsAString& aRole);
|
void GetRole(nsAString& aRole);
|
||||||
|
void GetStates(nsTArray<nsString>& aStates);
|
||||||
nsINode* GetDOMNode();
|
nsINode* GetDOMNode();
|
||||||
|
|
||||||
|
a11y::Accessible* Internal() const { return mIntl; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AccessibleNode(const AccessibleNode& aCopy) = delete;
|
AccessibleNode(const AccessibleNode& aCopy) = delete;
|
||||||
AccessibleNode& operator=(const AccessibleNode& aCopy) = delete;
|
AccessibleNode& operator=(const AccessibleNode& aCopy) = delete;
|
||||||
@@ -44,6 +50,7 @@ protected:
|
|||||||
|
|
||||||
RefPtr<a11y::Accessible> mIntl;
|
RefPtr<a11y::Accessible> mIntl;
|
||||||
RefPtr<nsINode> mDOMNode;
|
RefPtr<nsINode> mDOMNode;
|
||||||
|
RefPtr<dom::DOMStringList> mStates;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // dom
|
} // dom
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
'AccessibleNode.h',
|
'AccessibleNode.h'
|
||||||
]
|
]
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'AccessibleNode.cpp',
|
'AccessibleNode.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
|
|||||||
@@ -751,158 +751,12 @@ nsAccessibilityService::GetStringRole(uint32_t aRole, nsAString& aString)
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
|
nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
|
||||||
nsISupports **aStringStates)
|
nsISupports** aStringStates)
|
||||||
{
|
{
|
||||||
RefPtr<DOMStringList> stringStates = new DOMStringList();
|
RefPtr<DOMStringList> stringStates =
|
||||||
|
GetStringStates(nsAccUtils::To64State(aState, aExtraState));
|
||||||
|
|
||||||
uint64_t state = nsAccUtils::To64State(aState, aExtraState);
|
// unknown state
|
||||||
|
|
||||||
// states
|
|
||||||
if (state & states::UNAVAILABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("unavailable"));
|
|
||||||
}
|
|
||||||
if (state & states::SELECTED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("selected"));
|
|
||||||
}
|
|
||||||
if (state & states::FOCUSED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("focused"));
|
|
||||||
}
|
|
||||||
if (state & states::PRESSED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("pressed"));
|
|
||||||
}
|
|
||||||
if (state & states::CHECKED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("checked"));
|
|
||||||
}
|
|
||||||
if (state & states::MIXED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("mixed"));
|
|
||||||
}
|
|
||||||
if (state & states::READONLY) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("readonly"));
|
|
||||||
}
|
|
||||||
if (state & states::HOTTRACKED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("hottracked"));
|
|
||||||
}
|
|
||||||
if (state & states::DEFAULT) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("default"));
|
|
||||||
}
|
|
||||||
if (state & states::EXPANDED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("expanded"));
|
|
||||||
}
|
|
||||||
if (state & states::COLLAPSED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("collapsed"));
|
|
||||||
}
|
|
||||||
if (state & states::BUSY) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("busy"));
|
|
||||||
}
|
|
||||||
if (state & states::FLOATING) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("floating"));
|
|
||||||
}
|
|
||||||
if (state & states::ANIMATED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("animated"));
|
|
||||||
}
|
|
||||||
if (state & states::INVISIBLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("invisible"));
|
|
||||||
}
|
|
||||||
if (state & states::OFFSCREEN) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("offscreen"));
|
|
||||||
}
|
|
||||||
if (state & states::SIZEABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("sizeable"));
|
|
||||||
}
|
|
||||||
if (state & states::MOVEABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("moveable"));
|
|
||||||
}
|
|
||||||
if (state & states::SELFVOICING) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("selfvoicing"));
|
|
||||||
}
|
|
||||||
if (state & states::FOCUSABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("focusable"));
|
|
||||||
}
|
|
||||||
if (state & states::SELECTABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("selectable"));
|
|
||||||
}
|
|
||||||
if (state & states::LINKED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("linked"));
|
|
||||||
}
|
|
||||||
if (state & states::TRAVERSED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("traversed"));
|
|
||||||
}
|
|
||||||
if (state & states::MULTISELECTABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("multiselectable"));
|
|
||||||
}
|
|
||||||
if (state & states::EXTSELECTABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("extselectable"));
|
|
||||||
}
|
|
||||||
if (state & states::PROTECTED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("protected"));
|
|
||||||
}
|
|
||||||
if (state & states::HASPOPUP) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("haspopup"));
|
|
||||||
}
|
|
||||||
if (state & states::REQUIRED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("required"));
|
|
||||||
}
|
|
||||||
if (state & states::ALERT) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("alert"));
|
|
||||||
}
|
|
||||||
if (state & states::INVALID) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("invalid"));
|
|
||||||
}
|
|
||||||
if (state & states::CHECKABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("checkable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// extraStates
|
|
||||||
if (state & states::SUPPORTS_AUTOCOMPLETION) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("autocompletion"));
|
|
||||||
}
|
|
||||||
if (state & states::DEFUNCT) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("defunct"));
|
|
||||||
}
|
|
||||||
if (state & states::SELECTABLE_TEXT) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("selectable text"));
|
|
||||||
}
|
|
||||||
if (state & states::EDITABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("editable"));
|
|
||||||
}
|
|
||||||
if (state & states::ACTIVE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("active"));
|
|
||||||
}
|
|
||||||
if (state & states::MODAL) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("modal"));
|
|
||||||
}
|
|
||||||
if (state & states::MULTI_LINE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("multi line"));
|
|
||||||
}
|
|
||||||
if (state & states::HORIZONTAL) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("horizontal"));
|
|
||||||
}
|
|
||||||
if (state & states::OPAQUE1) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("opaque"));
|
|
||||||
}
|
|
||||||
if (state & states::SINGLE_LINE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("single line"));
|
|
||||||
}
|
|
||||||
if (state & states::TRANSIENT) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("transient"));
|
|
||||||
}
|
|
||||||
if (state & states::VERTICAL) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("vertical"));
|
|
||||||
}
|
|
||||||
if (state & states::STALE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("stale"));
|
|
||||||
}
|
|
||||||
if (state & states::ENABLED) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("enabled"));
|
|
||||||
}
|
|
||||||
if (state & states::SENSITIVE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("sensitive"));
|
|
||||||
}
|
|
||||||
if (state & states::EXPANDABLE) {
|
|
||||||
stringStates->Add(NS_LITERAL_STRING("expandable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//unknown states
|
|
||||||
if (!stringStates->Length()) {
|
if (!stringStates->Length()) {
|
||||||
stringStates->Add(NS_LITERAL_STRING("unknown"));
|
stringStates->Add(NS_LITERAL_STRING("unknown"));
|
||||||
}
|
}
|
||||||
@@ -910,6 +764,156 @@ nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
|
|||||||
stringStates.forget(aStringStates);
|
stringStates.forget(aStringStates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMStringList>
|
||||||
|
nsAccessibilityService::GetStringStates(uint64_t aStates) const
|
||||||
|
{
|
||||||
|
RefPtr<DOMStringList> stringStates = new DOMStringList();
|
||||||
|
|
||||||
|
if (aStates & states::UNAVAILABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("unavailable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SELECTED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("selected"));
|
||||||
|
}
|
||||||
|
if (aStates & states::FOCUSED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("focused"));
|
||||||
|
}
|
||||||
|
if (aStates & states::PRESSED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("pressed"));
|
||||||
|
}
|
||||||
|
if (aStates & states::CHECKED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("checked"));
|
||||||
|
}
|
||||||
|
if (aStates & states::MIXED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("mixed"));
|
||||||
|
}
|
||||||
|
if (aStates & states::READONLY) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("readonly"));
|
||||||
|
}
|
||||||
|
if (aStates & states::HOTTRACKED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("hottracked"));
|
||||||
|
}
|
||||||
|
if (aStates & states::DEFAULT) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("default"));
|
||||||
|
}
|
||||||
|
if (aStates & states::EXPANDED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("expanded"));
|
||||||
|
}
|
||||||
|
if (aStates & states::COLLAPSED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("collapsed"));
|
||||||
|
}
|
||||||
|
if (aStates & states::BUSY) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("busy"));
|
||||||
|
}
|
||||||
|
if (aStates & states::FLOATING) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("floating"));
|
||||||
|
}
|
||||||
|
if (aStates & states::ANIMATED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("animated"));
|
||||||
|
}
|
||||||
|
if (aStates & states::INVISIBLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("invisible"));
|
||||||
|
}
|
||||||
|
if (aStates & states::OFFSCREEN) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("offscreen"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SIZEABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("sizeable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::MOVEABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("moveable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SELFVOICING) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("selfvoicing"));
|
||||||
|
}
|
||||||
|
if (aStates & states::FOCUSABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("focusable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SELECTABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("selectable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::LINKED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("linked"));
|
||||||
|
}
|
||||||
|
if (aStates & states::TRAVERSED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("traversed"));
|
||||||
|
}
|
||||||
|
if (aStates & states::MULTISELECTABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("multiselectable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::EXTSELECTABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("extselectable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::PROTECTED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("protected"));
|
||||||
|
}
|
||||||
|
if (aStates & states::HASPOPUP) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("haspopup"));
|
||||||
|
}
|
||||||
|
if (aStates & states::REQUIRED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("required"));
|
||||||
|
}
|
||||||
|
if (aStates & states::ALERT) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("alert"));
|
||||||
|
}
|
||||||
|
if (aStates & states::INVALID) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("invalid"));
|
||||||
|
}
|
||||||
|
if (aStates & states::CHECKABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("checkable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SUPPORTS_AUTOCOMPLETION) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("autocompletion"));
|
||||||
|
}
|
||||||
|
if (aStates & states::DEFUNCT) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("defunct"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SELECTABLE_TEXT) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("selectable text"));
|
||||||
|
}
|
||||||
|
if (aStates & states::EDITABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("editable"));
|
||||||
|
}
|
||||||
|
if (aStates & states::ACTIVE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("active"));
|
||||||
|
}
|
||||||
|
if (aStates & states::MODAL) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("modal"));
|
||||||
|
}
|
||||||
|
if (aStates & states::MULTI_LINE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("multi line"));
|
||||||
|
}
|
||||||
|
if (aStates & states::HORIZONTAL) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("horizontal"));
|
||||||
|
}
|
||||||
|
if (aStates & states::OPAQUE1) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("opaque"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SINGLE_LINE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("single line"));
|
||||||
|
}
|
||||||
|
if (aStates & states::TRANSIENT) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("transient"));
|
||||||
|
}
|
||||||
|
if (aStates & states::VERTICAL) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("vertical"));
|
||||||
|
}
|
||||||
|
if (aStates & states::STALE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("stale"));
|
||||||
|
}
|
||||||
|
if (aStates & states::ENABLED) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("enabled"));
|
||||||
|
}
|
||||||
|
if (aStates & states::SENSITIVE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("sensitive"));
|
||||||
|
}
|
||||||
|
if (aStates & states::EXPANDABLE) {
|
||||||
|
stringStates->Add(NS_LITERAL_STRING("expandable"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringStates.forget();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsAccessibilityService::GetStringEventType(uint32_t aEventType,
|
nsAccessibilityService::GetStringEventType(uint32_t aEventType,
|
||||||
nsAString& aString)
|
nsAString& aString)
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ class nsPluginFrame;
|
|||||||
class nsITreeView;
|
class nsITreeView;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
namespace dom {
|
||||||
|
class DOMStringList;
|
||||||
|
}
|
||||||
|
|
||||||
namespace a11y {
|
namespace a11y {
|
||||||
|
|
||||||
class ApplicationAccessible;
|
class ApplicationAccessible;
|
||||||
@@ -108,6 +113,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get a string equivalent for an accessible state/extra state.
|
* Get a string equivalent for an accessible state/extra state.
|
||||||
*/
|
*/
|
||||||
|
already_AddRefed<mozilla::dom::DOMStringList>
|
||||||
|
GetStringStates(uint64_t aStates) const;
|
||||||
void GetStringStates(uint32_t aState, uint32_t aExtraState,
|
void GetStringStates(uint32_t aState, uint32_t aExtraState,
|
||||||
nsISupports **aStringStates);
|
nsISupports **aStringStates);
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,34 @@
|
|||||||
is(anode.role, 'document', 'correct role of a document accessible node');
|
is(anode.role, 'document', 'correct role of a document accessible node');
|
||||||
is(anode.DOMNode, ifrDoc, 'correct DOM Node of a document accessible node');
|
is(anode.DOMNode, ifrDoc, 'correct DOM Node of a document accessible node');
|
||||||
|
|
||||||
|
// States may differ depending on the document state, for example, if it is
|
||||||
|
// loaded or is loading still.
|
||||||
|
var states = null;
|
||||||
|
switch (anode.states.length) {
|
||||||
|
case 5:
|
||||||
|
states = [
|
||||||
|
'readonly', 'focusable', 'opaque', 'enabled', 'sensitive'
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
states = [
|
||||||
|
'readonly', 'busy', 'focusable', 'opaque', 'enabled', 'sensitive'
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
states = [
|
||||||
|
'readonly', 'busy', 'focusable', 'opaque', 'stale', 'enabled', 'sensitive'
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ok(false, 'Unexpected amount of states');
|
||||||
|
}
|
||||||
|
if (states) {
|
||||||
|
for (var i = 0; i < states.length; i++) {
|
||||||
|
is(anode.states[i], states[i], `${states[i]} state is expected at ${i}th index`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": ["error", {
|
|
||||||
"vars": "local",
|
|
||||||
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
|
|
||||||
"args": "none",
|
|
||||||
}],
|
|
||||||
"no-shadow": "error"
|
"no-shadow": "error"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsXULAppAPI.h"
|
#include "nsXULAppAPI.h"
|
||||||
#include "mozilla/AppData.h"
|
#include "mozilla/XREAppData.h"
|
||||||
#include "application.ini.h"
|
#include "application.ini.h"
|
||||||
#include "nsXPCOMGlue.h"
|
#include "nsXPCOMGlue.h"
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
@@ -163,8 +163,7 @@ static bool IsArg(const char* arg, const char* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRE_GetFileFromPathType XRE_GetFileFromPath;
|
XRE_GetFileFromPathType XRE_GetFileFromPath;
|
||||||
XRE_CreateAppDataType XRE_CreateAppData;
|
XRE_ParseAppDataType XRE_ParseAppData;
|
||||||
XRE_FreeAppDataType XRE_FreeAppData;
|
|
||||||
XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
|
XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
|
||||||
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
|
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
|
||||||
XRE_mainType XRE_main;
|
XRE_mainType XRE_main;
|
||||||
@@ -181,8 +180,7 @@ XRE_LibFuzzerGetFuncsType XRE_LibFuzzerGetFuncs;
|
|||||||
|
|
||||||
static const nsDynamicFunctionLoad kXULFuncs[] = {
|
static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||||
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
|
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
|
||||||
{ "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
|
{ "XRE_ParseAppData", (NSFuncPtr*) &XRE_ParseAppData },
|
||||||
{ "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
|
|
||||||
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
|
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
|
||||||
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
|
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
|
||||||
{ "XRE_main", (NSFuncPtr*) &XRE_main },
|
{ "XRE_main", (NSFuncPtr*) &XRE_main },
|
||||||
@@ -261,49 +259,43 @@ static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
|
|||||||
return XRE_XPCShellMain(--argc, argv, envp, &shellData);
|
return XRE_XPCShellMain(--argc, argv, envp, &shellData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XREAppData appData;
|
||||||
|
appData.xreDirectory = xreDirectory;
|
||||||
|
|
||||||
if (appini) {
|
if (appini) {
|
||||||
nsXREAppData *appData;
|
rv = XRE_ParseAppData(appini, appData);
|
||||||
rv = XRE_CreateAppData(appini, &appData);
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
Output("Couldn't read application.ini");
|
Output("Couldn't read application.ini");
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
#if defined(HAS_DLL_BLOCKLIST)
|
|
||||||
// The dll blocklist operates in the exe vs. xullib. Pass a flag to
|
|
||||||
// xullib so automated tests can check the result once the browser
|
|
||||||
// is up and running.
|
|
||||||
appData->flags |=
|
|
||||||
DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
|
|
||||||
#endif
|
|
||||||
// xreDirectory already has a refcount from NS_NewLocalFile
|
|
||||||
appData->xreDirectory = xreDirectory;
|
|
||||||
int result = XRE_main(argc, argv, appData, mainFlags);
|
|
||||||
XRE_FreeAppData(appData);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAppData appData(&sAppData);
|
appini->GetParent(getter_AddRefs(appData.directory));
|
||||||
nsCOMPtr<nsIFile> exeFile;
|
} else {
|
||||||
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
|
// no -app flag so we use the compiled-in app data
|
||||||
if (NS_FAILED(rv)) {
|
appData = sAppData;
|
||||||
Output("Couldn't find the application directory.\n");
|
|
||||||
return 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> greDir;
|
nsCOMPtr<nsIFile> exeFile;
|
||||||
exeFile->GetParent(getter_AddRefs(greDir));
|
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
Output("Couldn't find the application directory.\n");
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> greDir;
|
||||||
|
exeFile->GetParent(getter_AddRefs(greDir));
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
|
greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
|
||||||
#endif
|
#endif
|
||||||
nsCOMPtr<nsIFile> appSubdir;
|
nsCOMPtr<nsIFile> appSubdir;
|
||||||
greDir->Clone(getter_AddRefs(appSubdir));
|
greDir->Clone(getter_AddRefs(appSubdir));
|
||||||
appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
|
appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
|
||||||
|
appData.directory = appSubdir;
|
||||||
SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
|
}
|
||||||
// xreDirectory already has a refcount from NS_NewLocalFile
|
|
||||||
appData.xreDirectory = xreDirectory;
|
|
||||||
|
|
||||||
#if defined(HAS_DLL_BLOCKLIST)
|
#if defined(HAS_DLL_BLOCKLIST)
|
||||||
|
// The dll blocklist operates in the exe vs. xullib. Pass a flag to
|
||||||
|
// xullib so automated tests can check the result once the browser
|
||||||
|
// is up and running.
|
||||||
appData.flags |=
|
appData.flags |=
|
||||||
DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
|
DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -325,7 +317,7 @@ static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
|
|||||||
XRE_LibFuzzerSetMain(argc, argv, libfuzzer_main);
|
XRE_LibFuzzerSetMain(argc, argv, libfuzzer_main);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return XRE_main(argc, argv, &appData, mainFlags);
|
return XRE_main(argc, argv, appData, mainFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -445,9 +437,9 @@ int main(int argc, char* argv[], char* envp[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
nsIFile *xreDirectory;
|
nsCOMPtr<nsIFile> xreDirectory;
|
||||||
|
|
||||||
nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory);
|
nsresult rv = InitXPCOMGlue(argv[0], getter_AddRefs(xreDirectory));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
@@ -460,6 +452,7 @@ int main(int argc, char* argv[], char* envp[])
|
|||||||
|
|
||||||
int result = do_main(argc, argv, envp, xreDirectory);
|
int result = do_main(argc, argv, envp, xreDirectory);
|
||||||
|
|
||||||
|
xreDirectory = nullptr;
|
||||||
NS_LogTerm();
|
NS_LogTerm();
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": ["error", {
|
|
||||||
"vars": "local",
|
|
||||||
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
|
|
||||||
"args": "none",
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -247,7 +247,6 @@ var ctrlTab = {
|
|||||||
aPreview.appendChild(tabPreviews.get(aTab));
|
aPreview.appendChild(tabPreviews.get(aTab));
|
||||||
aPreview.setAttribute("label", aTab.label);
|
aPreview.setAttribute("label", aTab.label);
|
||||||
aPreview.setAttribute("tooltiptext", aTab.label);
|
aPreview.setAttribute("tooltiptext", aTab.label);
|
||||||
aPreview.setAttribute("crop", aTab.crop);
|
|
||||||
aPreview.setAttribute("canvaswidth", canvasWidth);
|
aPreview.setAttribute("canvaswidth", canvasWidth);
|
||||||
aPreview.setAttribute("canvasstyle",
|
aPreview.setAttribute("canvasstyle",
|
||||||
"max-width:" + canvasWidth + "px;" +
|
"max-width:" + canvasWidth + "px;" +
|
||||||
@@ -474,7 +473,7 @@ var ctrlTab = {
|
|||||||
this._initRecentlyUsedTabs();
|
this._initRecentlyUsedTabs();
|
||||||
break;
|
break;
|
||||||
case "TabAttrModified":
|
case "TabAttrModified":
|
||||||
// tab attribute modified (e.g. label, crop, busy, image, selected)
|
// tab attribute modified (e.g. label, busy, image, selected)
|
||||||
for (let i = this.previews.length - 1; i >= 0; i--) {
|
for (let i = this.previews.length - 1; i >= 0; i--) {
|
||||||
if (this.previews[i]._tab && this.previews[i]._tab == event.target) {
|
if (this.previews[i]._tab && this.previews[i]._tab == event.target) {
|
||||||
this.updatePreview(this.previews[i], event.target);
|
this.updatePreview(this.previews[i], event.target);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<xul:hbox class="tabPreview-canvas" xbl:inherits="style=canvasstyle">
|
<xul:hbox class="tabPreview-canvas" xbl:inherits="style=canvasstyle">
|
||||||
<children/>
|
<children/>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
<xul:label xbl:inherits="value=label,crop" class="plain"/>
|
<xul:label xbl:inherits="value=label" crop="end" class="plain"/>
|
||||||
</xul:vbox>
|
</xul:vbox>
|
||||||
<xul:hbox class="ctrlTab-favicon-container" xbl:inherits="hidden=noicon">
|
<xul:hbox class="ctrlTab-favicon-container" xbl:inherits="hidden=noicon">
|
||||||
<xul:image class="ctrlTab-favicon" xbl:inherits="src=image"/>
|
<xul:image class="ctrlTab-favicon" xbl:inherits="src=image"/>
|
||||||
|
|||||||
@@ -486,6 +486,7 @@ tags = fullscreen
|
|||||||
[browser_menuButtonBadgeManager.js]
|
[browser_menuButtonBadgeManager.js]
|
||||||
[browser_newTabDrop.js]
|
[browser_newTabDrop.js]
|
||||||
[browser_newWindowDrop.js]
|
[browser_newWindowDrop.js]
|
||||||
|
skip-if = true # bug 1323276
|
||||||
[browser_csp_block_all_mixedcontent.js]
|
[browser_csp_block_all_mixedcontent.js]
|
||||||
tags = mcb
|
tags = mcb
|
||||||
[browser_newwindow_focus.js]
|
[browser_newwindow_focus.js]
|
||||||
|
|||||||
@@ -67,3 +67,5 @@ support-files =
|
|||||||
[browser_imageCacheIsolation.js]
|
[browser_imageCacheIsolation.js]
|
||||||
[browser_sharedworker.js]
|
[browser_sharedworker.js]
|
||||||
[browser_httpauth.js]
|
[browser_httpauth.js]
|
||||||
|
[browser_clientAuth.js]
|
||||||
|
[browser_cacheAPI.js]
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const requestURL = "https://test1.example.com";
|
||||||
|
|
||||||
|
function getResult(aBrowser) {
|
||||||
|
return ContentTask.spawn(aBrowser, requestURL, function* (url) {
|
||||||
|
let cache = yield content.caches.open("TEST_CACHE");
|
||||||
|
let response = yield cache.match(url);
|
||||||
|
if (response) {
|
||||||
|
return response.statusText;
|
||||||
|
}
|
||||||
|
let result = Math.random().toString();
|
||||||
|
response = new content.Response("", { statusText: result });
|
||||||
|
yield cache.put(url, response);
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
IsolationTestTools.runTests("https://test2.example.com", getResult, null, null,
|
||||||
|
false, /* aUseHttps */ true);
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
let certCached = true;
|
||||||
|
let secondTabStarted = false;
|
||||||
|
|
||||||
|
function onCertDialogLoaded(subject) {
|
||||||
|
certCached = false;
|
||||||
|
// Click OK.
|
||||||
|
subject.acceptDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
Services.obs.addObserver(onCertDialogLoaded, "cert-dialog-loaded", false);
|
||||||
|
|
||||||
|
registerCleanupFunction(() => {
|
||||||
|
Services.obs.removeObserver(onCertDialogLoaded, "cert-dialog-loaded");
|
||||||
|
});
|
||||||
|
|
||||||
|
function* setup() {
|
||||||
|
yield SpecialPowers.pushPrefEnv({
|
||||||
|
set: [["security.default_personal_cert", "Ask Every Time"]]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResult() {
|
||||||
|
// The first tab always returns true.
|
||||||
|
if (!secondTabStarted) {
|
||||||
|
certCached = true;
|
||||||
|
secondTabStarted = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The second tab returns true if the cert is cached, so it will be different
|
||||||
|
// from the result of the first tab, and considered isolated.
|
||||||
|
let ret = certCached;
|
||||||
|
certCached = true;
|
||||||
|
secondTabStarted = false;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// aGetResultImmediately must be true because we need to get the result before
|
||||||
|
// the next tab is opened.
|
||||||
|
IsolationTestTools.runTests("https://requireclientcert.example.com",
|
||||||
|
getResult,
|
||||||
|
null, // aCompareResultFunc
|
||||||
|
setup, // aBeginFunc
|
||||||
|
true); // aGetResultImmediately
|
||||||
@@ -275,8 +275,11 @@ this.IsolationTestTools = {
|
|||||||
* @param aBeforeFunc
|
* @param aBeforeFunc
|
||||||
* An optional function which is called before any tabs are created so
|
* An optional function which is called before any tabs are created so
|
||||||
* that the test case can set up/reset local state.
|
* that the test case can set up/reset local state.
|
||||||
|
* @param aGetResultImmediately
|
||||||
|
* An optional boolean to ensure we get results before the next tab is opened.
|
||||||
*/
|
*/
|
||||||
runTests(aURL, aGetResultFuncs, aCompareResultFunc, aBeforeFunc) {
|
runTests(aURL, aGetResultFuncs, aCompareResultFunc, aBeforeFunc,
|
||||||
|
aGetResultImmediately, aUseHttps) {
|
||||||
let pageURL;
|
let pageURL;
|
||||||
let firstFrameSetting;
|
let firstFrameSetting;
|
||||||
let secondFrameSetting;
|
let secondFrameSetting;
|
||||||
@@ -298,7 +301,10 @@ this.IsolationTestTools = {
|
|||||||
aGetResultFuncs = [aGetResultFuncs];
|
aGetResultFuncs = [aGetResultFuncs];
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabSettings = [
|
let tabSettings = aUseHttps ? [
|
||||||
|
{ firstPartyDomain: "https://example.com", userContextId: 1},
|
||||||
|
{ firstPartyDomain: "https://example.org", userContextId: 2}
|
||||||
|
] : [
|
||||||
{ firstPartyDomain: "http://example.com", userContextId: 1},
|
{ firstPartyDomain: "http://example.com", userContextId: 1},
|
||||||
{ firstPartyDomain: "http://example.org", userContextId: 2}
|
{ firstPartyDomain: "http://example.org", userContextId: 2}
|
||||||
];
|
];
|
||||||
@@ -317,14 +323,21 @@ this.IsolationTestTools = {
|
|||||||
pageURL,
|
pageURL,
|
||||||
tabSettings[tabSettingA],
|
tabSettings[tabSettingA],
|
||||||
firstFrameSetting);
|
firstFrameSetting);
|
||||||
|
let resultsA = [];
|
||||||
|
if (aGetResultImmediately) {
|
||||||
|
for (let getResultFunc of aGetResultFuncs) {
|
||||||
|
resultsA.push(yield getResultFunc(tabInfoA.browser));
|
||||||
|
}
|
||||||
|
}
|
||||||
let tabInfoB = yield IsolationTestTools._addTab(aMode,
|
let tabInfoB = yield IsolationTestTools._addTab(aMode,
|
||||||
pageURL,
|
pageURL,
|
||||||
tabSettings[tabSettingB],
|
tabSettings[tabSettingB],
|
||||||
secondFrameSetting);
|
secondFrameSetting);
|
||||||
|
let i = 0;
|
||||||
for (let getResultFunc of aGetResultFuncs) {
|
for (let getResultFunc of aGetResultFuncs) {
|
||||||
// Fetch results from tabs.
|
// Fetch results from tabs.
|
||||||
let resultA = yield getResultFunc(tabInfoA.browser);
|
let resultA = aGetResultImmediately ? resultsA[i++] :
|
||||||
|
yield getResultFunc(tabInfoA.browser);
|
||||||
let resultB = yield getResultFunc(tabInfoB.browser);
|
let resultB = yield getResultFunc(tabInfoB.browser);
|
||||||
|
|
||||||
// Compare results.
|
// Compare results.
|
||||||
|
|||||||
@@ -974,10 +974,6 @@
|
|||||||
// Handle search bar popup clicks
|
// Handle search bar popup clicks
|
||||||
var search = controller.getValueAt(this.selectedIndex);
|
var search = controller.getValueAt(this.selectedIndex);
|
||||||
|
|
||||||
// close the autocomplete popup and revert the entered search term
|
|
||||||
this.closePopup();
|
|
||||||
controller.handleEscape();
|
|
||||||
|
|
||||||
// open the search results according to the clicking subtlety
|
// open the search results according to the clicking subtlety
|
||||||
var where = whereToOpenLink(aEvent, false, true);
|
var where = whereToOpenLink(aEvent, false, true);
|
||||||
let params = {};
|
let params = {};
|
||||||
@@ -990,6 +986,13 @@
|
|||||||
(aEvent.button == 1 || modifier))
|
(aEvent.button == 1 || modifier))
|
||||||
params.inBackground = true;
|
params.inBackground = true;
|
||||||
|
|
||||||
|
// leave the popup open for background tab loads
|
||||||
|
if (!(where == "tab" && params.inBackground)) {
|
||||||
|
// close the autocomplete popup and revert the entered search term
|
||||||
|
this.closePopup();
|
||||||
|
controller.handleEscape();
|
||||||
|
}
|
||||||
|
|
||||||
searchBar.doSearch(search, where, null, params);
|
searchBar.doSearch(search, where, null, params);
|
||||||
if (where == "tab" && params.inBackground)
|
if (where == "tab" && params.inBackground)
|
||||||
searchBar.focus();
|
searchBar.focus();
|
||||||
@@ -2227,14 +2230,6 @@
|
|||||||
if (!engine)
|
if (!engine)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// For some reason, if the context menu had been opened prior to the
|
|
||||||
// click, the suggestions popup won't be closed after loading the search
|
|
||||||
// in the current tab - so we hide it manually. Some focusing magic
|
|
||||||
// that happens when a search is loaded ensures that the popup is opened
|
|
||||||
// again if it needs to be, so we don't need to worry about which cases
|
|
||||||
// require manual hiding.
|
|
||||||
this.popup.hidePopup();
|
|
||||||
|
|
||||||
// Select the clicked button so that consumers can easily tell which
|
// Select the clicked button so that consumers can easily tell which
|
||||||
// button was acted on.
|
// button was acted on.
|
||||||
this.selectedButton = button;
|
this.selectedButton = button;
|
||||||
|
|||||||
@@ -776,13 +776,12 @@ menuitem.bookmark-item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#urlbar-search-splitter {
|
#urlbar-search-splitter {
|
||||||
-moz-appearance: none;
|
/* The splitter width should equal the location and search bars' combined
|
||||||
|
neighboring margin and border width. */
|
||||||
width: 8px;
|
width: 8px;
|
||||||
margin-inline-start: -4px;
|
margin: 0 -4px;
|
||||||
}
|
position: relative;
|
||||||
|
-moz-appearance: none;
|
||||||
#urlbar-search-splitter + #search-container > #searchbar > .searchbar-textbox {
|
|
||||||
margin-inline-start: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#urlbar-display-box {
|
#urlbar-display-box {
|
||||||
|
|||||||
@@ -240,11 +240,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav-bar-customization-target {
|
|
||||||
/* This shouldn't really be here. See bug 1322953. */
|
|
||||||
padding-inline-end: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PersonalToolbar {
|
#PersonalToolbar {
|
||||||
padding: 0 4px 4px;
|
padding: 0 4px 4px;
|
||||||
}
|
}
|
||||||
@@ -1710,7 +1705,6 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
|||||||
background-image: none;
|
background-image: none;
|
||||||
margin: 0 -4px;
|
margin: 0 -4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 22px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-container {
|
#search-container {
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ DIRS += ['communicator']
|
|||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
||||||
|
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
|
||||||
|
|
||||||
include('../tab-svgs.mozbuild')
|
include('../tab-svgs.mozbuild')
|
||||||
|
|||||||
@@ -1450,16 +1450,15 @@ html|*.urlbar-input:-moz-lwtheme::placeholder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#urlbar-search-splitter {
|
#urlbar-search-splitter {
|
||||||
min-width: 6px;
|
/* The splitter width should equal the location and search bars' combined
|
||||||
margin-inline-start: -3px;
|
neighboring margin and border width. */
|
||||||
|
min-width: 8px;
|
||||||
|
margin: 0 -4px;
|
||||||
|
position: relative;
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#urlbar-search-splitter + #search-container > #searchbar > .searchbar-textbox {
|
|
||||||
margin-inline-start: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.urlbar-display {
|
.urlbar-display {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ DIRS += ['communicator']
|
|||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
||||||
|
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
|
||||||
|
|
||||||
include('../tab-svgs.mozbuild')
|
include('../tab-svgs.mozbuild')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
'''Parses a given application.ini file and outputs the corresponding
|
'''Parses a given application.ini file and outputs the corresponding
|
||||||
XULAppData structure as a C++ header file'''
|
StaticXREAppData structure as a C++ header file'''
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import sys
|
import sys
|
||||||
@@ -34,10 +34,8 @@ def main(output, file):
|
|||||||
if not 'Crash Reporter:serverurl' in appdata:
|
if not 'Crash Reporter:serverurl' in appdata:
|
||||||
appdata['Crash Reporter:serverurl'] = ''
|
appdata['Crash Reporter:serverurl'] = ''
|
||||||
|
|
||||||
output.write('''#include "nsXREAppData.h"
|
output.write('''#include "mozilla/XREAppData.h"
|
||||||
static const nsXREAppData sAppData = {
|
static const mozilla::StaticXREAppData sAppData = {
|
||||||
sizeof(nsXREAppData),
|
|
||||||
NULL, // directory
|
|
||||||
"%(App:vendor)s",
|
"%(App:vendor)s",
|
||||||
"%(App:name)s",
|
"%(App:name)s",
|
||||||
"%(App:remotingname)s",
|
"%(App:remotingname)s",
|
||||||
@@ -46,7 +44,6 @@ def main(output, file):
|
|||||||
"%(App:id)s",
|
"%(App:id)s",
|
||||||
NULL, // copyright
|
NULL, // copyright
|
||||||
%(flags)s,
|
%(flags)s,
|
||||||
NULL, // xreDirectory
|
|
||||||
"%(Gecko:minversion)s",
|
"%(Gecko:minversion)s",
|
||||||
"%(Gecko:maxversion)s",
|
"%(Gecko:maxversion)s",
|
||||||
"%(Crash Reporter:serverurl)s",
|
"%(Crash Reporter:serverurl)s",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import sys
|
|||||||
from automation import Automation
|
from automation import Automation
|
||||||
from mozdevice import DMError, DeviceManager
|
from mozdevice import DMError, DeviceManager
|
||||||
from mozlog import get_default_logger
|
from mozlog import get_default_logger
|
||||||
|
from mozscreenshot import dump_screen
|
||||||
import mozcrash
|
import mozcrash
|
||||||
|
|
||||||
# signatures for logcat messages that we don't care about much
|
# signatures for logcat messages that we don't care about much
|
||||||
@@ -108,6 +109,7 @@ class RemoteAutomation(Automation):
|
|||||||
If maxTime seconds elapse or no output is detected for timeout
|
If maxTime seconds elapse or no output is detected for timeout
|
||||||
seconds, kill the process and fail the test.
|
seconds, kill the process and fail the test.
|
||||||
"""
|
"""
|
||||||
|
proc.utilityPath = utilityPath
|
||||||
# maxTime is used to override the default timeout, we should honor that
|
# maxTime is used to override the default timeout, we should honor that
|
||||||
status = proc.wait(timeout = maxTime, noOutputTimeout = timeout)
|
status = proc.wait(timeout = maxTime, noOutputTimeout = timeout)
|
||||||
self.lastTestSeen = proc.getLastTestSeen
|
self.lastTestSeen = proc.getLastTestSeen
|
||||||
@@ -284,6 +286,7 @@ class RemoteAutomation(Automation):
|
|||||||
self.lastTestSeen = "remoteautomation.py"
|
self.lastTestSeen = "remoteautomation.py"
|
||||||
self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
|
self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
|
||||||
self.messageLogger = messageLogger
|
self.messageLogger = messageLogger
|
||||||
|
self.utilityPath = None
|
||||||
|
|
||||||
if (self.proc is None):
|
if (self.proc is None):
|
||||||
if cmd[0] == 'am':
|
if cmd[0] == 'am':
|
||||||
@@ -408,6 +411,13 @@ class RemoteAutomation(Automation):
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
def kill(self, stagedShutdown = False):
|
def kill(self, stagedShutdown = False):
|
||||||
|
if self.utilityPath:
|
||||||
|
# Take a screenshot to capture the screen state just before
|
||||||
|
# the application is killed. There are on-device screenshot
|
||||||
|
# options but they rarely work well with Firefox on the
|
||||||
|
# Android emulator. dump_screen provides an effective
|
||||||
|
# screenshot of the emulator and its host desktop.
|
||||||
|
dump_screen(self.utilityPath, get_default_logger())
|
||||||
if stagedShutdown:
|
if stagedShutdown:
|
||||||
# Trigger an ANR report with "kill -3" (SIGQUIT)
|
# Trigger an ANR report with "kill -3" (SIGQUIT)
|
||||||
self.dm.killProcess(self.procName, 3)
|
self.dm.killProcess(self.procName, 3)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function ReadOnlyEditor(container, node) {
|
|||||||
this.tag.classList.add("theme-fg-color5");
|
this.tag.classList.add("theme-fg-color5");
|
||||||
this.tag.textContent = node.isBeforePseudoElement ? "::before" : "::after";
|
this.tag.textContent = node.isBeforePseudoElement ? "::before" : "::after";
|
||||||
} else if (node.nodeType == nodeConstants.DOCUMENT_TYPE_NODE) {
|
} else if (node.nodeType == nodeConstants.DOCUMENT_TYPE_NODE) {
|
||||||
this.elt.classList.add("comment");
|
this.elt.classList.add("comment", "doctype");
|
||||||
this.tag.textContent = node.doctypeString;
|
this.tag.textContent = node.doctypeString;
|
||||||
} else {
|
} else {
|
||||||
this.tag.textContent = node.nodeName;
|
this.tag.textContent = node.nodeName;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root[platform="linux"] .devtools-monospace {
|
:root[platform="linux"] .devtools-monospace {
|
||||||
font-size: 80%;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override wrong system font from forms.css */
|
/* Override wrong system font from forms.css */
|
||||||
|
|||||||
@@ -299,6 +299,7 @@ ul.children + .tag-line::before {
|
|||||||
|
|
||||||
.theme-firebug .theme-fg-color3 {
|
.theme-firebug .theme-fg-color3 {
|
||||||
color: var(--theme-graphs-full-blue);
|
color: var(--theme-graphs-full-blue);
|
||||||
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-firebug .open,
|
.theme-firebug .open,
|
||||||
@@ -335,10 +336,19 @@ ul.children + .tag-line::before {
|
|||||||
color: var(--theme-selection-color);
|
color: var(--theme-selection-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Applicable to the DOCTYPE */
|
||||||
|
.doctype {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-firebug .doctype {
|
||||||
|
color: #787878;
|
||||||
|
}
|
||||||
|
|
||||||
/* In case a node isn't displayed in the page, we fade the syntax highlighting */
|
/* In case a node isn't displayed in the page, we fade the syntax highlighting */
|
||||||
.not-displayed .open,
|
.not-displayed .open,
|
||||||
.not-displayed .close {
|
.not-displayed .close {
|
||||||
opacity: .7;
|
opacity: .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
|
|
||||||
/* Rule View Tabpanel */
|
/* Rule View Tabpanel */
|
||||||
|
|
||||||
.theme-firebug .ruleview {
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar-panel-ruleview {
|
#sidebar-panel-ruleview {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root.theme-firebug {
|
:root.theme-firebug {
|
||||||
--theme-body-background: #fcfcfc;
|
--theme-body-background: #fff;
|
||||||
--theme-sidebar-background: #fcfcfc;
|
--theme-sidebar-background: #fcfcfc;
|
||||||
--theme-contrast-background: #e6b064;
|
--theme-contrast-background: #e6b064;
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
--theme-selection-background-semitransparent: rgba(128,128,128,0.2);
|
--theme-selection-background-semitransparent: rgba(128,128,128,0.2);
|
||||||
--theme-selection-color: white;
|
--theme-selection-color: white;
|
||||||
--theme-splitter-color: #aabccf;
|
--theme-splitter-color: #aabccf;
|
||||||
--theme-comment: green;
|
--theme-comment: darkgreen;
|
||||||
|
|
||||||
--theme-body-color: #000000;
|
--theme-body-color: #000000;
|
||||||
--theme-body-color-alt: #585959;
|
--theme-body-color-alt: #585959;
|
||||||
@@ -156,10 +156,10 @@
|
|||||||
--theme-highlight-green: #2cbb0f;
|
--theme-highlight-green: #2cbb0f;
|
||||||
--theme-highlight-blue: #3455db;
|
--theme-highlight-blue: #3455db;
|
||||||
--theme-highlight-bluegrey: #0072ab;
|
--theme-highlight-bluegrey: #0072ab;
|
||||||
--theme-highlight-purple: #887ce6;
|
--theme-highlight-purple: #000080;
|
||||||
--theme-highlight-lightorange: #d97e00;
|
--theme-highlight-lightorange: #d97e00;
|
||||||
--theme-highlight-orange: #f13c00;
|
--theme-highlight-orange: #f13c00;
|
||||||
--theme-highlight-red: #e22f6f;
|
--theme-highlight-red: #f00;
|
||||||
--theme-highlight-pink: #b82ee5;
|
--theme-highlight-pink: #b82ee5;
|
||||||
--theme-highlight-gray: #dde1e4;
|
--theme-highlight-gray: #dde1e4;
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ NS_IMPL_ISUPPORTS0(ArchiveItem)
|
|||||||
|
|
||||||
ArchiveItem::ArchiveItem()
|
ArchiveItem::ArchiveItem()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ArchiveItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveItem::~ArchiveItem()
|
ArchiveItem::~ArchiveItem()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +41,6 @@ ArchiveItem::SetType(const nsCString& aType)
|
|||||||
ArchiveReaderEvent::ArchiveReaderEvent(ArchiveReader* aArchiveReader)
|
ArchiveReaderEvent::ArchiveReaderEvent(ArchiveReader* aArchiveReader)
|
||||||
: mArchiveReader(aArchiveReader)
|
: mArchiveReader(aArchiveReader)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ArchiveReaderEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveReaderEvent::~ArchiveReaderEvent()
|
ArchiveReaderEvent::~ArchiveReaderEvent()
|
||||||
@@ -51,8 +48,6 @@ ArchiveReaderEvent::~ArchiveReaderEvent()
|
|||||||
if (!NS_IsMainThread()) {
|
if (!NS_IsMainThread()) {
|
||||||
NS_ReleaseOnMainThread(mMimeService.forget());
|
NS_ReleaseOnMainThread(mMimeService.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_COUNT_DTOR(ArchiveReaderEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// From the filename to the mimetype:
|
// From the filename to the mimetype:
|
||||||
|
|||||||
@@ -26,13 +26,11 @@ public:
|
|||||||
explicit ArchiveRequestEvent(ArchiveRequest* aRequest)
|
explicit ArchiveRequestEvent(ArchiveRequest* aRequest)
|
||||||
: mRequest(aRequest)
|
: mRequest(aRequest)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ArchiveRequestEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~ArchiveRequestEvent()
|
~ArchiveRequestEvent()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveRequestEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private: //data
|
private: //data
|
||||||
@@ -56,8 +54,6 @@ ArchiveRequest::ArchiveRequest(nsPIDOMWindowInner* aWindow,
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(aReader);
|
MOZ_ASSERT(aReader);
|
||||||
|
|
||||||
MOZ_COUNT_CTOR(ArchiveRequest);
|
|
||||||
|
|
||||||
/* An event to make this request asynchronous: */
|
/* An event to make this request asynchronous: */
|
||||||
RefPtr<ArchiveRequestEvent> event = new ArchiveRequestEvent(this);
|
RefPtr<ArchiveRequestEvent> event = new ArchiveRequestEvent(this);
|
||||||
NS_DispatchToCurrentThread(event);
|
NS_DispatchToCurrentThread(event);
|
||||||
@@ -65,7 +61,6 @@ ArchiveRequest::ArchiveRequest(nsPIDOMWindowInner* aWindow,
|
|||||||
|
|
||||||
ArchiveRequest::~ArchiveRequest()
|
ArchiveRequest::~ArchiveRequest()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveRequest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -28,12 +28,10 @@ ArchiveZipItem::ArchiveZipItem(const char* aFilename,
|
|||||||
mCentralStruct(aCentralStruct),
|
mCentralStruct(aCentralStruct),
|
||||||
mEncoding(aEncoding)
|
mEncoding(aEncoding)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ArchiveZipItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveZipItem::~ArchiveZipItem()
|
ArchiveZipItem::~ArchiveZipItem()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveZipItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public:
|
|||||||
mLength(aLength),
|
mLength(aLength),
|
||||||
mStatus(NotStarted)
|
mStatus(NotStarted)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ArchiveInputStream);
|
|
||||||
|
|
||||||
// Reset the data:
|
// Reset the data:
|
||||||
memset(&mData, 0, sizeof(mData));
|
memset(&mData, 0, sizeof(mData));
|
||||||
|
|
||||||
@@ -52,7 +50,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
virtual ~ArchiveInputStream()
|
virtual ~ArchiveInputStream()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveInputStream);
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public:
|
|||||||
mFilename(aName)
|
mFilename(aName)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mBlobImpl);
|
MOZ_ASSERT(mBlobImpl);
|
||||||
MOZ_COUNT_CTOR(ArchiveZipBlobImpl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveZipBlobImpl(const nsAString& aName,
|
ArchiveZipBlobImpl(const nsAString& aName,
|
||||||
@@ -52,7 +51,6 @@ public:
|
|||||||
mFilename(aName)
|
mFilename(aName)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mBlobImpl);
|
MOZ_ASSERT(mBlobImpl);
|
||||||
MOZ_COUNT_CTOR(ArchiveZipBlobImpl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overrides:
|
// Overrides:
|
||||||
@@ -62,7 +60,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual ~ArchiveZipBlobImpl()
|
virtual ~ArchiveZipBlobImpl()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ArchiveZipBlobImpl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual already_AddRefed<BlobImpl>
|
virtual already_AddRefed<BlobImpl>
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ public:
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
MOZ_COUNT_CTOR(ParentRunnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -369,7 +368,6 @@ private:
|
|||||||
MOZ_ASSERT(mState == eFinished);
|
MOZ_ASSERT(mState == eFinished);
|
||||||
MOZ_ASSERT(!mDirectoryLock);
|
MOZ_ASSERT(!mDirectoryLock);
|
||||||
MOZ_ASSERT(mActorDestroyed);
|
MOZ_ASSERT(mActorDestroyed);
|
||||||
MOZ_COUNT_DTOR(ParentRunnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -1233,7 +1231,6 @@ public:
|
|||||||
mOpened(false)
|
mOpened(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_COUNT_CTOR(ChildRunnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::AsmJSCacheResult
|
JS::AsmJSCacheResult
|
||||||
@@ -1282,7 +1279,6 @@ private:
|
|||||||
MOZ_ASSERT(!mOpened);
|
MOZ_ASSERT(!mOpened);
|
||||||
MOZ_ASSERT(mState == eFinished);
|
MOZ_ASSERT(mState == eFinished);
|
||||||
MOZ_ASSERT(mActorDestroyed);
|
MOZ_ASSERT(mActorDestroyed);
|
||||||
MOZ_COUNT_DTOR(ChildRunnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IPDL methods.
|
// IPDL methods.
|
||||||
|
|||||||
@@ -32,12 +32,10 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Crypto, mParent, mSubtle)
|
|||||||
|
|
||||||
Crypto::Crypto()
|
Crypto::Crypto()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(Crypto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Crypto::~Crypto()
|
Crypto::~Crypto()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(Crypto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "mozilla/dom/IdleDeadline.h"
|
#include "mozilla/dom/IdleDeadline.h"
|
||||||
#include "mozilla/dom/Performance.h"
|
#include "mozilla/dom/Performance.h"
|
||||||
#include "mozilla/dom/PerformanceTiming.h"
|
#include "mozilla/dom/PerformanceTiming.h"
|
||||||
|
#include "mozilla/dom/TimeoutManager.h"
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
#include "mozilla/dom/WindowBinding.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
@@ -63,7 +64,7 @@ nsresult
|
|||||||
IdleRequest::SetTimeout(uint32_t aTimeout)
|
IdleRequest::SetTimeout(uint32_t aTimeout)
|
||||||
{
|
{
|
||||||
int32_t handle;
|
int32_t handle;
|
||||||
nsresult rv = nsGlobalWindow::Cast(mWindow)->SetTimeoutOrInterval(
|
nsresult rv = mWindow->TimeoutManager().SetTimeout(
|
||||||
this, aTimeout, false, Timeout::Reason::eIdleCallbackTimeout, &handle);
|
this, aTimeout, false, Timeout::Reason::eIdleCallbackTimeout, &handle);
|
||||||
mTimeoutHandle = Some(handle);
|
mTimeoutHandle = Some(handle);
|
||||||
|
|
||||||
@@ -125,7 +126,7 @@ void
|
|||||||
IdleRequest::CancelTimeout()
|
IdleRequest::CancelTimeout()
|
||||||
{
|
{
|
||||||
if (mTimeoutHandle.isSome()) {
|
if (mTimeoutHandle.isSome()) {
|
||||||
nsGlobalWindow::Cast(mWindow)->ClearTimeoutOrInterval(
|
mWindow->TimeoutManager().ClearTimeout(
|
||||||
mTimeoutHandle.value(), Timeout::Reason::eIdleCallbackTimeout);
|
mTimeoutHandle.value(), Timeout::Reason::eIdleCallbackTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,12 +44,10 @@ PostMessageEvent::PostMessageEvent(nsGlobalWindow* aSource,
|
|||||||
mSourceDocument(aSourceDocument),
|
mSourceDocument(aSourceDocument),
|
||||||
mTrustedCaller(aTrustedCaller)
|
mTrustedCaller(aTrustedCaller)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(PostMessageEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PostMessageEvent::~PostMessageEvent()
|
PostMessageEvent::~PostMessageEvent()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(PostMessageEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
|||||||
nsCSSParser cssParser;
|
nsCSSParser cssParser;
|
||||||
|
|
||||||
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
||||||
mSizeQueries, mSizeValues, true);
|
mSizeQueries, mSizeValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -739,12 +739,10 @@ NS_IMPL_RELEASE_INHERITED(ShadowRootStyleSheetList, StyleSheetList)
|
|||||||
ShadowRootStyleSheetList::ShadowRootStyleSheetList(ShadowRoot* aShadowRoot)
|
ShadowRootStyleSheetList::ShadowRootStyleSheetList(ShadowRoot* aShadowRoot)
|
||||||
: mShadowRoot(aShadowRoot)
|
: mShadowRoot(aShadowRoot)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ShadowRootStyleSheetList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowRootStyleSheetList::~ShadowRootStyleSheetList()
|
ShadowRootStyleSheetList::~ShadowRootStyleSheetList()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ShadowRootStyleSheetList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSheet*
|
StyleSheet*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
#include "nsITimeoutHandler.h"
|
#include "nsITimeoutHandler.h"
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
|
#include "mozilla/dom/TimeoutManager.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
@@ -60,7 +61,7 @@ void
|
|||||||
TimerCallback(nsITimer*, void* aClosure)
|
TimerCallback(nsITimer*, void* aClosure)
|
||||||
{
|
{
|
||||||
RefPtr<Timeout> timeout = (Timeout*)aClosure;
|
RefPtr<Timeout> timeout = (Timeout*)aClosure;
|
||||||
timeout->mWindow->RunTimeout(timeout);
|
timeout->mWindow->AsInner()->TimeoutManager().RunTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
897
dom/base/TimeoutManager.cpp
Normal file
897
dom/base/TimeoutManager.cpp
Normal file
@@ -0,0 +1,897 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "TimeoutManager.h"
|
||||||
|
#include "nsGlobalWindow.h"
|
||||||
|
#include "mozilla/ThrottledEventQueue.h"
|
||||||
|
#include "mozilla/TimeStamp.h"
|
||||||
|
#include "nsITimeoutHandler.h"
|
||||||
|
#include "mozilla/dom/TabGroup.h"
|
||||||
|
|
||||||
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
static int32_t gRunningTimeoutDepth = 0;
|
||||||
|
|
||||||
|
// The default shortest interval/timeout we permit
|
||||||
|
#define DEFAULT_MIN_TIMEOUT_VALUE 4 // 4ms
|
||||||
|
#define DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE 1000 // 1000ms
|
||||||
|
static int32_t gMinTimeoutValue;
|
||||||
|
static int32_t gMinBackgroundTimeoutValue;
|
||||||
|
int32_t
|
||||||
|
TimeoutManager::DOMMinTimeoutValue() const {
|
||||||
|
// First apply any back pressure delay that might be in effect.
|
||||||
|
int32_t value = std::max(mBackPressureDelayMS, 0);
|
||||||
|
// Don't use the background timeout value when there are audio contexts
|
||||||
|
// present, so that background audio can keep running smoothly. (bug 1181073)
|
||||||
|
bool isBackground = !mWindow.AsInner()->HasAudioContexts() &&
|
||||||
|
mWindow.IsBackgroundInternal();
|
||||||
|
return
|
||||||
|
std::max(isBackground ? gMinBackgroundTimeoutValue : gMinTimeoutValue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The number of nested timeouts before we start clamping. HTML5 says 1, WebKit
|
||||||
|
// uses 5.
|
||||||
|
#define DOM_CLAMP_TIMEOUT_NESTING_LEVEL 5
|
||||||
|
|
||||||
|
// The longest interval (as PRIntervalTime) we permit, or that our
|
||||||
|
// timer code can handle, really. See DELAY_INTERVAL_LIMIT in
|
||||||
|
// nsTimerImpl.h for details.
|
||||||
|
#define DOM_MAX_TIMEOUT_VALUE DELAY_INTERVAL_LIMIT
|
||||||
|
|
||||||
|
uint32_t TimeoutManager::sNestingLevel = 0;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// The number of queued runnables within the TabGroup ThrottledEventQueue
|
||||||
|
// at which to begin applying back pressure to the window.
|
||||||
|
const uint32_t kThrottledEventQueueBackPressure = 5000;
|
||||||
|
|
||||||
|
// The amount of delay to apply to timers when back pressure is triggered.
|
||||||
|
// As the length of the ThrottledEventQueue grows delay is increased. The
|
||||||
|
// delay is scaled such that every kThrottledEventQueueBackPressure runnables
|
||||||
|
// in the queue equates to an additional kBackPressureDelayMS.
|
||||||
|
const double kBackPressureDelayMS = 500;
|
||||||
|
|
||||||
|
// Convert a ThrottledEventQueue length to a timer delay in milliseconds.
|
||||||
|
// This will return a value between kBackPressureDelayMS and INT32_MAX.
|
||||||
|
int32_t
|
||||||
|
CalculateNewBackPressureDelayMS(uint32_t aBacklogDepth)
|
||||||
|
{
|
||||||
|
// The calculations here assume we are only operating while in back
|
||||||
|
// pressure conditions.
|
||||||
|
MOZ_ASSERT(aBacklogDepth >= kThrottledEventQueueBackPressure);
|
||||||
|
double multiplier = static_cast<double>(aBacklogDepth) /
|
||||||
|
static_cast<double>(kThrottledEventQueueBackPressure);
|
||||||
|
double value = kBackPressureDelayMS * multiplier;
|
||||||
|
if (value > INT32_MAX) {
|
||||||
|
value = INT32_MAX;
|
||||||
|
}
|
||||||
|
return static_cast<int32_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
TimeoutManager::TimeoutManager(nsGlobalWindow& aWindow)
|
||||||
|
: mWindow(aWindow),
|
||||||
|
mTimeoutInsertionPoint(nullptr),
|
||||||
|
mTimeoutIdCounter(1),
|
||||||
|
mTimeoutFiringDepth(0),
|
||||||
|
mRunningTimeout(nullptr),
|
||||||
|
mIdleCallbackTimeoutCounter(1),
|
||||||
|
mBackPressureDelayMS(0)
|
||||||
|
{
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(aWindow.IsInnerWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
void
|
||||||
|
TimeoutManager::Initialize()
|
||||||
|
{
|
||||||
|
Preferences::AddIntVarCache(&gMinTimeoutValue,
|
||||||
|
"dom.min_timeout_value",
|
||||||
|
DEFAULT_MIN_TIMEOUT_VALUE);
|
||||||
|
Preferences::AddIntVarCache(&gMinBackgroundTimeoutValue,
|
||||||
|
"dom.min_background_timeout_value",
|
||||||
|
DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
TimeoutManager::GetTimeoutId(Timeout::Reason aReason)
|
||||||
|
{
|
||||||
|
switch (aReason) {
|
||||||
|
case Timeout::Reason::eIdleCallbackTimeout:
|
||||||
|
return ++mIdleCallbackTimeoutCounter;
|
||||||
|
case Timeout::Reason::eTimeoutOrInterval:
|
||||||
|
default:
|
||||||
|
return ++mTimeoutIdCounter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
TimeoutManager::SetTimeout(nsITimeoutHandler* aHandler,
|
||||||
|
int32_t interval, bool aIsInterval,
|
||||||
|
Timeout::Reason aReason, int32_t* aReturn)
|
||||||
|
{
|
||||||
|
// If we don't have a document (we could have been unloaded since
|
||||||
|
// the call to setTimeout was made), do nothing.
|
||||||
|
if (!mWindow.GetExtantDoc()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disallow negative intervals. If aIsInterval also disallow 0,
|
||||||
|
// because we use that as a "don't repeat" flag.
|
||||||
|
interval = std::max(aIsInterval ? 1 : 0, interval);
|
||||||
|
|
||||||
|
// Make sure we don't proceed with an interval larger than our timer
|
||||||
|
// code can handle. (Note: we already forced |interval| to be non-negative,
|
||||||
|
// so the uint32_t cast (to avoid compiler warnings) is ok.)
|
||||||
|
uint32_t maxTimeoutMs = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
|
||||||
|
if (static_cast<uint32_t>(interval) > maxTimeoutMs) {
|
||||||
|
interval = maxTimeoutMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<Timeout> timeout = new Timeout();
|
||||||
|
timeout->mIsInterval = aIsInterval;
|
||||||
|
timeout->mInterval = interval;
|
||||||
|
timeout->mScriptHandler = aHandler;
|
||||||
|
timeout->mReason = aReason;
|
||||||
|
|
||||||
|
// Now clamp the actual interval we will use for the timer based on
|
||||||
|
uint32_t nestingLevel = sNestingLevel + 1;
|
||||||
|
uint32_t realInterval = interval;
|
||||||
|
if (aIsInterval || nestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL ||
|
||||||
|
mBackPressureDelayMS > 0 || mWindow.IsBackgroundInternal()) {
|
||||||
|
// Don't allow timeouts less than DOMMinTimeoutValue() from
|
||||||
|
// now...
|
||||||
|
realInterval = std::max(realInterval, uint32_t(DOMMinTimeoutValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeDuration delta = TimeDuration::FromMilliseconds(realInterval);
|
||||||
|
|
||||||
|
if (mWindow.IsFrozen()) {
|
||||||
|
// If we are frozen simply set timeout->mTimeRemaining to be the
|
||||||
|
// "time remaining" in the timeout (i.e., the interval itself). This
|
||||||
|
// will be used to create a new mWhen time when the window is thawed.
|
||||||
|
// The end effect is that time does not appear to pass for frozen windows.
|
||||||
|
timeout->mTimeRemaining = delta;
|
||||||
|
} else {
|
||||||
|
// Since we are not frozen we must set a precise mWhen target wakeup
|
||||||
|
// time. Even if we are suspended we want to use this target time so
|
||||||
|
// that it appears time passes while suspended.
|
||||||
|
timeout->mWhen = TimeStamp::Now() + delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're not suspended, then set the timer.
|
||||||
|
if (!mWindow.IsSuspended()) {
|
||||||
|
MOZ_ASSERT(!timeout->mWhen.IsNull());
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
timeout->mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<Timeout> copy = timeout;
|
||||||
|
|
||||||
|
rv = timeout->InitTimer(mWindow.GetThrottledEventQueue(), realInterval);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The timeout is now also held in the timer's closure.
|
||||||
|
Unused << copy.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout->mWindow = &mWindow;
|
||||||
|
|
||||||
|
if (!aIsInterval) {
|
||||||
|
timeout->mNestingLevel = nestingLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No popups from timeouts by default
|
||||||
|
timeout->mPopupState = openAbused;
|
||||||
|
|
||||||
|
if (gRunningTimeoutDepth == 0 &&
|
||||||
|
mWindow.GetPopupControlState() < openAbused) {
|
||||||
|
// This timeout is *not* set from another timeout and it's set
|
||||||
|
// while popups are enabled. Propagate the state to the timeout if
|
||||||
|
// its delay (interval) is equal to or less than what
|
||||||
|
// "dom.disable_open_click_delay" is set to (in ms).
|
||||||
|
|
||||||
|
int32_t delay =
|
||||||
|
Preferences::GetInt("dom.disable_open_click_delay");
|
||||||
|
|
||||||
|
// This is checking |interval|, not realInterval, on purpose,
|
||||||
|
// because our lower bound for |realInterval| could be pretty high
|
||||||
|
// in some cases.
|
||||||
|
if (interval <= delay) {
|
||||||
|
timeout->mPopupState = mWindow.GetPopupControlState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertTimeoutIntoList(timeout);
|
||||||
|
|
||||||
|
timeout->mTimeoutId = GetTimeoutId(aReason);
|
||||||
|
*aReturn = timeout->mTimeoutId;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::ClearTimeout(int32_t aTimerId, Timeout::Reason aReason)
|
||||||
|
{
|
||||||
|
uint32_t timerId = (uint32_t)aTimerId;
|
||||||
|
Timeout* timeout;
|
||||||
|
|
||||||
|
for (timeout = mTimeouts.getFirst(); timeout; timeout = timeout->getNext()) {
|
||||||
|
if (timeout->mTimeoutId == timerId && timeout->mReason == aReason) {
|
||||||
|
if (timeout->mRunning) {
|
||||||
|
/* We're running from inside the timeout. Mark this
|
||||||
|
timeout for deferred deletion by the code in
|
||||||
|
RunTimeout() */
|
||||||
|
timeout->mIsInterval = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Delete the timeout from the pending timeout list */
|
||||||
|
timeout->remove();
|
||||||
|
|
||||||
|
if (timeout->mTimer) {
|
||||||
|
timeout->mTimer->Cancel();
|
||||||
|
timeout->mTimer = nullptr;
|
||||||
|
timeout->Release();
|
||||||
|
}
|
||||||
|
timeout->Release();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::RunTimeout(Timeout* aTimeout)
|
||||||
|
{
|
||||||
|
if (mWindow.IsSuspended()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(!mWindow.IsFrozen(), "Timeout running on a window in the bfcache!");
|
||||||
|
|
||||||
|
Timeout* nextTimeout;
|
||||||
|
Timeout* last_expired_timeout;
|
||||||
|
Timeout* last_insertion_point;
|
||||||
|
uint32_t firingDepth = mTimeoutFiringDepth + 1;
|
||||||
|
|
||||||
|
// Make sure that the window and the script context don't go away as
|
||||||
|
// a result of running timeouts
|
||||||
|
nsCOMPtr<nsIScriptGlobalObject> windowKungFuDeathGrip(&mWindow);
|
||||||
|
// Silence the static analysis error about windowKungFuDeathGrip. Accessing
|
||||||
|
// members of mWindow here is safe, because the lifetime of TimeoutManager is
|
||||||
|
// the same as the lifetime of the containing nsGlobalWindow.
|
||||||
|
Unused << windowKungFuDeathGrip;
|
||||||
|
|
||||||
|
// A native timer has gone off. See which of our timeouts need
|
||||||
|
// servicing
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
TimeStamp deadline;
|
||||||
|
|
||||||
|
if (aTimeout && aTimeout->mWhen > now) {
|
||||||
|
// The OS timer fired early (which can happen due to the timers
|
||||||
|
// having lower precision than TimeStamp does). Set |deadline| to
|
||||||
|
// be the time when the OS timer *should* have fired so that any
|
||||||
|
// timers that *should* have fired before aTimeout *will* be fired
|
||||||
|
// now.
|
||||||
|
|
||||||
|
deadline = aTimeout->mWhen;
|
||||||
|
} else {
|
||||||
|
deadline = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The timeout list is kept in deadline order. Discover the latest timeout
|
||||||
|
// whose deadline has expired. On some platforms, native timeout events fire
|
||||||
|
// "early", but we handled that above by setting deadline to aTimeout->mWhen
|
||||||
|
// if the timer fired early. So we can stop walking if we get to timeouts
|
||||||
|
// whose mWhen is greater than deadline, since once that happens we know
|
||||||
|
// nothing past that point is expired.
|
||||||
|
last_expired_timeout = nullptr;
|
||||||
|
for (Timeout* timeout = mTimeouts.getFirst();
|
||||||
|
timeout && timeout->mWhen <= deadline;
|
||||||
|
timeout = timeout->getNext()) {
|
||||||
|
if (timeout->mFiringDepth == 0) {
|
||||||
|
// Mark any timeouts that are on the list to be fired with the
|
||||||
|
// firing depth so that we can reentrantly run timeouts
|
||||||
|
timeout->mFiringDepth = firingDepth;
|
||||||
|
last_expired_timeout = timeout;
|
||||||
|
|
||||||
|
// Run available timers until we see our target timer. After
|
||||||
|
// that, however, stop coalescing timers so we can yield the
|
||||||
|
// main thread. Further timers that are ready will get picked
|
||||||
|
// up by their own nsITimer runnables when they execute.
|
||||||
|
//
|
||||||
|
// For chrome windows, however, we do coalesce all timers and
|
||||||
|
// do not yield the main thread. This is partly because we
|
||||||
|
// trust chrome windows not to misbehave and partly because a
|
||||||
|
// number of browser chrome tests have races that depend on this
|
||||||
|
// coalescing.
|
||||||
|
if (timeout == aTimeout && !mWindow.IsChromeWindow()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maybe the timeout that the event was fired for has been deleted
|
||||||
|
// and there are no others timeouts with deadlines that make them
|
||||||
|
// eligible for execution yet. Go away.
|
||||||
|
if (!last_expired_timeout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert a dummy timeout into the list of timeouts between the
|
||||||
|
// portion of the list that we are about to process now and those
|
||||||
|
// timeouts that will be processed in a future call to
|
||||||
|
// win_run_timeout(). This dummy timeout serves as the head of the
|
||||||
|
// list for any timeouts inserted as a result of running a timeout.
|
||||||
|
RefPtr<Timeout> dummy_timeout = new Timeout();
|
||||||
|
dummy_timeout->mFiringDepth = firingDepth;
|
||||||
|
dummy_timeout->mWhen = now;
|
||||||
|
last_expired_timeout->setNext(dummy_timeout);
|
||||||
|
RefPtr<Timeout> timeoutExtraRef(dummy_timeout);
|
||||||
|
|
||||||
|
last_insertion_point = mTimeoutInsertionPoint;
|
||||||
|
// If we ever start setting mTimeoutInsertionPoint to a non-dummy timeout,
|
||||||
|
// the logic in ResetTimersForThrottleReduction will need to change.
|
||||||
|
mTimeoutInsertionPoint = dummy_timeout;
|
||||||
|
|
||||||
|
for (Timeout* timeout = mTimeouts.getFirst();
|
||||||
|
timeout != dummy_timeout && !mWindow.IsFrozen();
|
||||||
|
timeout = nextTimeout) {
|
||||||
|
nextTimeout = timeout->getNext();
|
||||||
|
|
||||||
|
if (timeout->mFiringDepth != firingDepth) {
|
||||||
|
// We skip the timeout since it's on the list to run at another
|
||||||
|
// depth.
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mWindow.IsSuspended()) {
|
||||||
|
// Some timer did suspend us. Make sure the
|
||||||
|
// rest of the timers get executed later.
|
||||||
|
timeout->mFiringDepth = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The timeout is on the list to run at this depth, go ahead and
|
||||||
|
// process it.
|
||||||
|
|
||||||
|
// Get the script context (a strong ref to prevent it going away)
|
||||||
|
// for this timeout and ensure the script language is enabled.
|
||||||
|
nsCOMPtr<nsIScriptContext> scx = mWindow.GetContextInternal();
|
||||||
|
|
||||||
|
if (!scx) {
|
||||||
|
// No context means this window was closed or never properly
|
||||||
|
// initialized for this language.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This timeout is good to run
|
||||||
|
bool timeout_was_cleared = mWindow.RunTimeoutHandler(timeout, scx);
|
||||||
|
|
||||||
|
if (timeout_was_cleared) {
|
||||||
|
// The running timeout's window was cleared, this means that
|
||||||
|
// ClearAllTimeouts() was called from a *nested* call, possibly
|
||||||
|
// through a timeout that fired while a modal (to this window)
|
||||||
|
// dialog was open or through other non-obvious paths.
|
||||||
|
MOZ_ASSERT(dummy_timeout->HasRefCntOne(), "dummy_timeout may leak");
|
||||||
|
Unused << timeoutExtraRef.forget().take();
|
||||||
|
|
||||||
|
mTimeoutInsertionPoint = last_insertion_point;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have a regular interval timer, we re-schedule the
|
||||||
|
// timeout, accounting for clock drift.
|
||||||
|
bool needsReinsertion = RescheduleTimeout(timeout, now, !aTimeout);
|
||||||
|
|
||||||
|
// Running a timeout can cause another timeout to be deleted, so
|
||||||
|
// we need to reset the pointer to the following timeout.
|
||||||
|
nextTimeout = timeout->getNext();
|
||||||
|
|
||||||
|
timeout->remove();
|
||||||
|
|
||||||
|
if (needsReinsertion) {
|
||||||
|
// Insert interval timeout onto list sorted in deadline order.
|
||||||
|
// AddRefs timeout.
|
||||||
|
InsertTimeoutIntoList(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release the timeout struct since it's possibly out of the list
|
||||||
|
timeout->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take the dummy timeout off the head of the list
|
||||||
|
dummy_timeout->remove();
|
||||||
|
timeoutExtraRef = nullptr;
|
||||||
|
MOZ_ASSERT(dummy_timeout->HasRefCntOne(), "dummy_timeout may leak");
|
||||||
|
|
||||||
|
mTimeoutInsertionPoint = last_insertion_point;
|
||||||
|
|
||||||
|
MaybeApplyBackPressure();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::MaybeApplyBackPressure()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
// If we are already in back pressure then we don't need to apply back
|
||||||
|
// pressure again. We also shouldn't need to apply back pressure while
|
||||||
|
// the window is suspended.
|
||||||
|
if (mBackPressureDelayMS > 0 || mWindow.IsSuspended()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<ThrottledEventQueue> queue = mWindow.TabGroup()->GetThrottledEventQueue();
|
||||||
|
if (!queue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only begin back pressure if the window has greatly fallen behind the main
|
||||||
|
// thread. This is a somewhat arbitrary threshold chosen such that it should
|
||||||
|
// rarely fire under normaly circumstances. Its low enough, though,
|
||||||
|
// that we should have time to slow new runnables from being added before an
|
||||||
|
// OOM occurs.
|
||||||
|
if (queue->Length() < kThrottledEventQueueBackPressure) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// First attempt to dispatch a runnable to update our back pressure state. We
|
||||||
|
// do this first in order to verify we can dispatch successfully before
|
||||||
|
// entering the back pressure state.
|
||||||
|
nsCOMPtr<nsIRunnable> r =
|
||||||
|
NewNonOwningRunnableMethod<StorensRefPtrPassByPtr<nsGlobalWindow>>(this,
|
||||||
|
&TimeoutManager::CancelOrUpdateBackPressure, &mWindow);
|
||||||
|
nsresult rv = queue->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
|
||||||
|
NS_ENSURE_SUCCESS_VOID(rv);
|
||||||
|
|
||||||
|
// Since the callback was scheduled successfully we can now persist the
|
||||||
|
// backpressure value.
|
||||||
|
mBackPressureDelayMS = CalculateNewBackPressureDelayMS(queue->Length());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::CancelOrUpdateBackPressure(nsGlobalWindow* aWindow)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(aWindow == &mWindow);
|
||||||
|
MOZ_ASSERT(mBackPressureDelayMS > 0);
|
||||||
|
|
||||||
|
// First, check to see if we are still in back pressure. If we've dropped
|
||||||
|
// below the threshold we can simply drop our back pressure delay. We
|
||||||
|
// must also reset timers to remove the old back pressure delay in order to
|
||||||
|
// avoid out-of-order timer execution.
|
||||||
|
RefPtr<ThrottledEventQueue> queue = mWindow.TabGroup()->GetThrottledEventQueue();
|
||||||
|
if (!queue || queue->Length() < kThrottledEventQueueBackPressure) {
|
||||||
|
int32_t oldBackPressureDelayMS = mBackPressureDelayMS;
|
||||||
|
mBackPressureDelayMS = 0;
|
||||||
|
ResetTimersForThrottleReduction(oldBackPressureDelayMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise we are still in back pressure mode.
|
||||||
|
|
||||||
|
// Re-calculate the back pressure delay.
|
||||||
|
int32_t oldBackPressureDelayMS = mBackPressureDelayMS;
|
||||||
|
mBackPressureDelayMS = CalculateNewBackPressureDelayMS(queue->Length());
|
||||||
|
|
||||||
|
// If the back pressure delay has gone down we must reset any existing
|
||||||
|
// timers to use the new value. Otherwise we run the risk of executing
|
||||||
|
// timer callbacks out-of-order.
|
||||||
|
if (mBackPressureDelayMS < oldBackPressureDelayMS) {
|
||||||
|
ResetTimersForThrottleReduction(oldBackPressureDelayMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispatch another runnable to update the back pressure state again.
|
||||||
|
nsCOMPtr<nsIRunnable> r =
|
||||||
|
NewNonOwningRunnableMethod<StorensRefPtrPassByPtr<nsGlobalWindow>>(this,
|
||||||
|
&TimeoutManager::CancelOrUpdateBackPressure, &mWindow);
|
||||||
|
MOZ_ALWAYS_SUCCEEDS(queue->Dispatch(r.forget(), NS_DISPATCH_NORMAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TimeoutManager::RescheduleTimeout(Timeout* aTimeout, const TimeStamp& now,
|
||||||
|
bool aRunningPendingTimeouts)
|
||||||
|
{
|
||||||
|
if (!aTimeout->mIsInterval) {
|
||||||
|
if (aTimeout->mTimer) {
|
||||||
|
// The timeout still has an OS timer, and it's not an interval,
|
||||||
|
// that means that the OS timer could still fire; cancel the OS
|
||||||
|
// timer and release its reference to the timeout.
|
||||||
|
aTimeout->mTimer->Cancel();
|
||||||
|
aTimeout->mTimer = nullptr;
|
||||||
|
aTimeout->Release();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute time to next timeout for interval timer.
|
||||||
|
// Make sure nextInterval is at least DOMMinTimeoutValue().
|
||||||
|
TimeDuration nextInterval =
|
||||||
|
TimeDuration::FromMilliseconds(std::max(aTimeout->mInterval,
|
||||||
|
uint32_t(DOMMinTimeoutValue())));
|
||||||
|
|
||||||
|
// If we're running pending timeouts, set the next interval to be
|
||||||
|
// relative to "now", and not to when the timeout that was pending
|
||||||
|
// should have fired.
|
||||||
|
TimeStamp firingTime;
|
||||||
|
if (aRunningPendingTimeouts) {
|
||||||
|
firingTime = now + nextInterval;
|
||||||
|
} else {
|
||||||
|
firingTime = aTimeout->mWhen + nextInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeStamp currentNow = TimeStamp::Now();
|
||||||
|
TimeDuration delay = firingTime - currentNow;
|
||||||
|
|
||||||
|
// And make sure delay is nonnegative; that might happen if the timer
|
||||||
|
// thread is firing our timers somewhat early or if they're taking a long
|
||||||
|
// time to run the callback.
|
||||||
|
if (delay < TimeDuration(0)) {
|
||||||
|
delay = TimeDuration(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aTimeout->mTimer) {
|
||||||
|
NS_ASSERTION(mWindow.IsFrozen() || mWindow.IsSuspended(),
|
||||||
|
"How'd our timer end up null if we're not frozen or "
|
||||||
|
"suspended?");
|
||||||
|
|
||||||
|
aTimeout->mTimeRemaining = delay;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
aTimeout->mWhen = currentNow + delay;
|
||||||
|
|
||||||
|
// Reschedule the OS timer. Don't bother returning any error codes if
|
||||||
|
// this fails since the callers of this method don't care about them.
|
||||||
|
nsresult rv = aTimeout->InitTimer(mWindow.GetThrottledEventQueue(),
|
||||||
|
delay.ToMilliseconds());
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
NS_ERROR("Error initializing timer for DOM timeout!");
|
||||||
|
|
||||||
|
// We failed to initialize the new OS timer, this timer does
|
||||||
|
// us no good here so we just cancel it (just in case) and
|
||||||
|
// null out the pointer to the OS timer, this will release the
|
||||||
|
// OS timer. As we continue executing the code below we'll end
|
||||||
|
// up deleting the timeout since it's not an interval timeout
|
||||||
|
// any more (since timeout->mTimer == nullptr).
|
||||||
|
aTimeout->mTimer->Cancel();
|
||||||
|
aTimeout->mTimer = nullptr;
|
||||||
|
|
||||||
|
// Now that the OS timer no longer has a reference to the
|
||||||
|
// timeout we need to drop that reference.
|
||||||
|
aTimeout->Release();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
TimeoutManager::ResetTimersForThrottleReduction()
|
||||||
|
{
|
||||||
|
return ResetTimersForThrottleReduction(gMinBackgroundTimeoutValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
TimeoutManager::ResetTimersForThrottleReduction(int32_t aPreviousThrottleDelayMS)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aPreviousThrottleDelayMS > 0);
|
||||||
|
|
||||||
|
if (mWindow.IsFrozen() || mWindow.IsSuspended()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
|
||||||
|
// If mTimeoutInsertionPoint is non-null, we're in the middle of firing
|
||||||
|
// timers and the timers we're planning to fire all come before
|
||||||
|
// mTimeoutInsertionPoint; mTimeoutInsertionPoint itself is a dummy timeout
|
||||||
|
// with an mWhen that may be semi-bogus. In that case, we don't need to do
|
||||||
|
// anything with mTimeoutInsertionPoint or anything before it, so should
|
||||||
|
// start at the timer after mTimeoutInsertionPoint, if there is one.
|
||||||
|
// Otherwise, start at the beginning of the list.
|
||||||
|
for (Timeout* timeout = mTimeoutInsertionPoint ?
|
||||||
|
mTimeoutInsertionPoint->getNext() : mTimeouts.getFirst();
|
||||||
|
timeout; ) {
|
||||||
|
// It's important that this check be <= so that we guarantee that
|
||||||
|
// taking std::max with |now| won't make a quantity equal to
|
||||||
|
// timeout->mWhen below.
|
||||||
|
if (timeout->mWhen <= now) {
|
||||||
|
timeout = timeout->getNext();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeout->mWhen - now >
|
||||||
|
TimeDuration::FromMilliseconds(aPreviousThrottleDelayMS)) {
|
||||||
|
// No need to loop further. Timeouts are sorted in mWhen order
|
||||||
|
// and the ones after this point were all set up for at least
|
||||||
|
// gMinBackgroundTimeoutValue ms and hence were not clamped.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We reduced our throttled delay. Re-init the timer appropriately.
|
||||||
|
// Compute the interval the timer should have had if it had not been set in a
|
||||||
|
// background window
|
||||||
|
TimeDuration interval =
|
||||||
|
TimeDuration::FromMilliseconds(std::max(timeout->mInterval,
|
||||||
|
uint32_t(DOMMinTimeoutValue())));
|
||||||
|
uint32_t oldIntervalMillisecs = 0;
|
||||||
|
timeout->mTimer->GetDelay(&oldIntervalMillisecs);
|
||||||
|
TimeDuration oldInterval = TimeDuration::FromMilliseconds(oldIntervalMillisecs);
|
||||||
|
if (oldInterval > interval) {
|
||||||
|
// unclamp
|
||||||
|
TimeStamp firingTime =
|
||||||
|
std::max(timeout->mWhen - oldInterval + interval, now);
|
||||||
|
|
||||||
|
NS_ASSERTION(firingTime < timeout->mWhen,
|
||||||
|
"Our firing time should strictly decrease!");
|
||||||
|
|
||||||
|
TimeDuration delay = firingTime - now;
|
||||||
|
timeout->mWhen = firingTime;
|
||||||
|
|
||||||
|
// Since we reset mWhen we need to move |timeout| to the right
|
||||||
|
// place in the list so that it remains sorted by mWhen.
|
||||||
|
|
||||||
|
// Get the pointer to the next timeout now, before we move the
|
||||||
|
// current timeout in the list.
|
||||||
|
Timeout* nextTimeout = timeout->getNext();
|
||||||
|
|
||||||
|
// It is safe to remove and re-insert because mWhen is now
|
||||||
|
// strictly smaller than it used to be, so we know we'll insert
|
||||||
|
// |timeout| before nextTimeout.
|
||||||
|
NS_ASSERTION(!nextTimeout ||
|
||||||
|
timeout->mWhen < nextTimeout->mWhen, "How did that happen?");
|
||||||
|
timeout->remove();
|
||||||
|
// InsertTimeoutIntoList will addref |timeout| and reset
|
||||||
|
// mFiringDepth. Make sure to undo that after calling it.
|
||||||
|
uint32_t firingDepth = timeout->mFiringDepth;
|
||||||
|
InsertTimeoutIntoList(timeout);
|
||||||
|
timeout->mFiringDepth = firingDepth;
|
||||||
|
timeout->Release();
|
||||||
|
|
||||||
|
nsresult rv = timeout->InitTimer(mWindow.GetThrottledEventQueue(),
|
||||||
|
delay.ToMilliseconds());
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
NS_WARNING("Error resetting non background timer for DOM timeout!");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout = nextTimeout;
|
||||||
|
} else {
|
||||||
|
timeout = timeout->getNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::ClearAllTimeouts()
|
||||||
|
{
|
||||||
|
Timeout* timeout;
|
||||||
|
Timeout* nextTimeout;
|
||||||
|
|
||||||
|
for (timeout = mTimeouts.getFirst(); timeout; timeout = nextTimeout) {
|
||||||
|
/* If RunTimeout() is higher up on the stack for this
|
||||||
|
window, e.g. as a result of document.write from a timeout,
|
||||||
|
then we need to reset the list insertion point for
|
||||||
|
newly-created timeouts in case the user adds a timeout,
|
||||||
|
before we pop the stack back to RunTimeout. */
|
||||||
|
if (mRunningTimeout == timeout)
|
||||||
|
mTimeoutInsertionPoint = nullptr;
|
||||||
|
|
||||||
|
nextTimeout = timeout->getNext();
|
||||||
|
|
||||||
|
if (timeout->mTimer) {
|
||||||
|
timeout->mTimer->Cancel();
|
||||||
|
timeout->mTimer = nullptr;
|
||||||
|
|
||||||
|
// Drop the count since the timer isn't going to hold on
|
||||||
|
// anymore.
|
||||||
|
timeout->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set timeout->mCleared to true to indicate that the timeout was
|
||||||
|
// cleared and taken out of the list of timeouts
|
||||||
|
timeout->mCleared = true;
|
||||||
|
|
||||||
|
// Drop the count since we're removing it from the list.
|
||||||
|
timeout->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear out our list
|
||||||
|
mTimeouts.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::InsertTimeoutIntoList(Timeout* aTimeout)
|
||||||
|
{
|
||||||
|
// Start at mLastTimeout and go backwards. Don't go further than
|
||||||
|
// mTimeoutInsertionPoint, though. This optimizes for the common case of
|
||||||
|
// insertion at the end.
|
||||||
|
Timeout* prevSibling;
|
||||||
|
for (prevSibling = mTimeouts.getLast();
|
||||||
|
prevSibling && prevSibling != mTimeoutInsertionPoint &&
|
||||||
|
// This condition needs to match the one in SetTimeoutOrInterval that
|
||||||
|
// determines whether to set mWhen or mTimeRemaining.
|
||||||
|
(mWindow.IsFrozen() ?
|
||||||
|
prevSibling->mTimeRemaining > aTimeout->mTimeRemaining :
|
||||||
|
prevSibling->mWhen > aTimeout->mWhen);
|
||||||
|
prevSibling = prevSibling->getPrevious()) {
|
||||||
|
/* Do nothing; just searching */
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now link in aTimeout after prevSibling.
|
||||||
|
if (prevSibling) {
|
||||||
|
prevSibling->setNext(aTimeout);
|
||||||
|
} else {
|
||||||
|
mTimeouts.insertFront(aTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
aTimeout->mFiringDepth = 0;
|
||||||
|
|
||||||
|
// Increment the timeout's reference count since it's now held on to
|
||||||
|
// by the list
|
||||||
|
aTimeout->AddRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
Timeout*
|
||||||
|
TimeoutManager::BeginRunningTimeout(Timeout* aTimeout)
|
||||||
|
{
|
||||||
|
Timeout* currentTimeout = mRunningTimeout;
|
||||||
|
mRunningTimeout = aTimeout;
|
||||||
|
|
||||||
|
++gRunningTimeoutDepth;
|
||||||
|
++mTimeoutFiringDepth;
|
||||||
|
|
||||||
|
return currentTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::EndRunningTimeout(Timeout* aTimeout)
|
||||||
|
{
|
||||||
|
--mTimeoutFiringDepth;
|
||||||
|
--gRunningTimeoutDepth;
|
||||||
|
|
||||||
|
mRunningTimeout = aTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::UnmarkGrayTimers()
|
||||||
|
{
|
||||||
|
for (Timeout* timeout = mTimeouts.getFirst();
|
||||||
|
timeout;
|
||||||
|
timeout = timeout->getNext()) {
|
||||||
|
if (timeout->mScriptHandler) {
|
||||||
|
timeout->mScriptHandler->MarkForCC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::Suspend()
|
||||||
|
{
|
||||||
|
for (Timeout* t = mTimeouts.getFirst(); t; t = t->getNext()) {
|
||||||
|
// Leave the timers with the current time remaining. This will
|
||||||
|
// cause the timers to potentially fire when the window is
|
||||||
|
// Resume()'d. Time effectively passes while suspended.
|
||||||
|
|
||||||
|
// Drop the XPCOM timer; we'll reschedule when restoring the state.
|
||||||
|
if (t->mTimer) {
|
||||||
|
t->mTimer->Cancel();
|
||||||
|
t->mTimer = nullptr;
|
||||||
|
|
||||||
|
// Drop the reference that the timer's closure had on this timeout, we'll
|
||||||
|
// add it back in Resume().
|
||||||
|
t->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::Resume()
|
||||||
|
{
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
DebugOnly<bool> _seenDummyTimeout = false;
|
||||||
|
|
||||||
|
for (Timeout* t = mTimeouts.getFirst(); t; t = t->getNext()) {
|
||||||
|
// There's a chance we're being called with RunTimeout on the stack in which
|
||||||
|
// case we have a dummy timeout in the list that *must not* be resumed. It
|
||||||
|
// can be identified by a null mWindow.
|
||||||
|
if (!t->mWindow) {
|
||||||
|
NS_ASSERTION(!_seenDummyTimeout, "More than one dummy timeout?!");
|
||||||
|
_seenDummyTimeout = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
MOZ_ASSERT(!t->mTimer);
|
||||||
|
|
||||||
|
// The timeout mWhen is set to the absolute time when the timer should
|
||||||
|
// fire. Recalculate the delay from now until that deadline. If the
|
||||||
|
// the deadline has already passed or falls within our minimum delay
|
||||||
|
// deadline, then clamp the resulting value to the minimum delay. The
|
||||||
|
// mWhen will remain at its absolute time, but we won't fire the OS
|
||||||
|
// timer until our calculated delay has passed.
|
||||||
|
int32_t remaining = 0;
|
||||||
|
if (t->mWhen > now) {
|
||||||
|
remaining = static_cast<int32_t>((t->mWhen - now).ToMilliseconds());
|
||||||
|
}
|
||||||
|
uint32_t delay = std::max(remaining, DOMMinTimeoutValue());
|
||||||
|
|
||||||
|
t->mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||||
|
if (!t->mTimer) {
|
||||||
|
t->remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult rv = t->InitTimer(mWindow.GetThrottledEventQueue(), delay);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
t->mTimer = nullptr;
|
||||||
|
t->remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a reference for the new timer's closure.
|
||||||
|
t->AddRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::Freeze()
|
||||||
|
{
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
for (Timeout *t = mTimeouts.getFirst(); t; t = t->getNext()) {
|
||||||
|
// Save the current remaining time for this timeout. We will
|
||||||
|
// re-apply it when the window is Thaw()'d. This effectively
|
||||||
|
// shifts timers to the right as if time does not pass while
|
||||||
|
// the window is frozen.
|
||||||
|
if (t->mWhen > now) {
|
||||||
|
t->mTimeRemaining = t->mWhen - now;
|
||||||
|
} else {
|
||||||
|
t->mTimeRemaining = TimeDuration(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we are suspended there should be no OS timer set for
|
||||||
|
// this timeout entry.
|
||||||
|
MOZ_ASSERT(!t->mTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeoutManager::Thaw()
|
||||||
|
{
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
DebugOnly<bool> _seenDummyTimeout = false;
|
||||||
|
|
||||||
|
for (Timeout *t = mTimeouts.getFirst(); t; t = t->getNext()) {
|
||||||
|
// There's a chance we're being called with RunTimeout on the stack in which
|
||||||
|
// case we have a dummy timeout in the list that *must not* be resumed. It
|
||||||
|
// can be identified by a null mWindow.
|
||||||
|
if (!t->mWindow) {
|
||||||
|
NS_ASSERTION(!_seenDummyTimeout, "More than one dummy timeout?!");
|
||||||
|
_seenDummyTimeout = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set mWhen back to the time when the timer is supposed to fire.
|
||||||
|
t->mWhen = now + t->mTimeRemaining;
|
||||||
|
|
||||||
|
MOZ_ASSERT(!t->mTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
128
dom/base/TimeoutManager.h
Normal file
128
dom/base/TimeoutManager.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_TimeoutManager_h__
|
||||||
|
#define mozilla_dom_TimeoutManager_h__
|
||||||
|
|
||||||
|
#include "mozilla/dom/Timeout.h"
|
||||||
|
|
||||||
|
class nsITimeoutHandler;
|
||||||
|
class nsGlobalWindow;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
// This class manages the timeouts in a Window's setTimeout/setInterval pool.
|
||||||
|
class TimeoutManager final
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit TimeoutManager(nsGlobalWindow& aWindow);
|
||||||
|
TimeoutManager(const TimeoutManager& rhs) = delete;
|
||||||
|
void operator=(const TimeoutManager& rhs) = delete;
|
||||||
|
|
||||||
|
bool IsRunningTimeout() const { return mTimeoutFiringDepth > 0; }
|
||||||
|
|
||||||
|
static uint32_t GetNestingLevel() { return sNestingLevel; }
|
||||||
|
static void SetNestingLevel(uint32_t aLevel) { sNestingLevel = aLevel; }
|
||||||
|
|
||||||
|
bool HasTimeouts() const { return !mTimeouts.isEmpty(); }
|
||||||
|
|
||||||
|
nsresult SetTimeout(nsITimeoutHandler* aHandler,
|
||||||
|
int32_t interval, bool aIsInterval,
|
||||||
|
mozilla::dom::Timeout::Reason aReason,
|
||||||
|
int32_t* aReturn);
|
||||||
|
void ClearTimeout(int32_t aTimerId,
|
||||||
|
mozilla::dom::Timeout::Reason aReason);
|
||||||
|
|
||||||
|
// The timeout implementation functions.
|
||||||
|
void RunTimeout(mozilla::dom::Timeout* aTimeout);
|
||||||
|
// Return true if |aTimeout| needs to be reinserted into the timeout list.
|
||||||
|
bool RescheduleTimeout(mozilla::dom::Timeout* aTimeout, const TimeStamp& now,
|
||||||
|
bool aRunningPendingTimeouts);
|
||||||
|
|
||||||
|
void ClearAllTimeouts();
|
||||||
|
// Insert aTimeout into the list, before all timeouts that would
|
||||||
|
// fire after it, but no earlier than mTimeoutInsertionPoint, if any.
|
||||||
|
void InsertTimeoutIntoList(mozilla::dom::Timeout* aTimeout);
|
||||||
|
uint32_t GetTimeoutId(mozilla::dom::Timeout::Reason aReason);
|
||||||
|
|
||||||
|
// Apply back pressure to the window if the TabGroup ThrottledEventQueue
|
||||||
|
// exists and has too many runnables waiting to run. For example, increase
|
||||||
|
// the minimum timer delay, etc.
|
||||||
|
void MaybeApplyBackPressure();
|
||||||
|
|
||||||
|
// Check the current ThrottledEventQueue depth and update the back pressure
|
||||||
|
// state. If the queue has drained back pressure may be canceled.
|
||||||
|
void CancelOrUpdateBackPressure(nsGlobalWindow* aWindow);
|
||||||
|
|
||||||
|
// When timers are being throttled and we reduce the thottle delay we must
|
||||||
|
// reschedule. The amount of the old throttle delay must be provided in
|
||||||
|
// order to bound how many timers must be examined.
|
||||||
|
nsresult ResetTimersForThrottleReduction();
|
||||||
|
|
||||||
|
int32_t DOMMinTimeoutValue() const;
|
||||||
|
|
||||||
|
// aTimeout is the timeout that we're about to start running. This function
|
||||||
|
// returns the current timeout.
|
||||||
|
mozilla::dom::Timeout* BeginRunningTimeout(mozilla::dom::Timeout* aTimeout);
|
||||||
|
// aTimeout is the last running timeout.
|
||||||
|
void EndRunningTimeout(mozilla::dom::Timeout* aTimeout);
|
||||||
|
|
||||||
|
void UnmarkGrayTimers();
|
||||||
|
|
||||||
|
// These four methods are intended to be called from the corresponding methods
|
||||||
|
// on nsGlobalWindow.
|
||||||
|
void Suspend();
|
||||||
|
void Resume();
|
||||||
|
void Freeze();
|
||||||
|
void Thaw();
|
||||||
|
|
||||||
|
// Initialize TimeoutManager before the first time it is accessed.
|
||||||
|
static void Initialize();
|
||||||
|
|
||||||
|
// Run some code for each Timeout in our list.
|
||||||
|
template <class Callable>
|
||||||
|
void ForEachTimeout(Callable c)
|
||||||
|
{
|
||||||
|
for (Timeout* timeout = mTimeouts.getFirst();
|
||||||
|
timeout;
|
||||||
|
timeout = timeout->getNext()) {
|
||||||
|
c(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsresult ResetTimersForThrottleReduction(int32_t aPreviousThrottleDelayMS);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Each nsGlobalWindow object has a TimeoutManager member. This reference
|
||||||
|
// points to that holder object.
|
||||||
|
nsGlobalWindow& mWindow;
|
||||||
|
// mTimeouts is generally sorted by mWhen, unless mTimeoutInsertionPoint is
|
||||||
|
// non-null. In that case, the dummy timeout pointed to by
|
||||||
|
// mTimeoutInsertionPoint may have a later mWhen than some of the timeouts
|
||||||
|
// that come after it.
|
||||||
|
mozilla::LinkedList<mozilla::dom::Timeout> mTimeouts;
|
||||||
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
||||||
|
// This is a dummy timeout at the moment; if that ever changes, the logic in
|
||||||
|
// ResetTimersForThrottleReduction needs to change.
|
||||||
|
mozilla::dom::Timeout* mTimeoutInsertionPoint;
|
||||||
|
uint32_t mTimeoutIdCounter;
|
||||||
|
uint32_t mTimeoutFiringDepth;
|
||||||
|
mozilla::dom::Timeout* mRunningTimeout;
|
||||||
|
|
||||||
|
// The current idle request callback timeout handle
|
||||||
|
uint32_t mIdleCallbackTimeoutCounter;
|
||||||
|
|
||||||
|
int32_t mBackPressureDelayMS;
|
||||||
|
|
||||||
|
static uint32_t sNestingLevel;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -205,6 +205,7 @@ EXPORTS.mozilla.dom += [
|
|||||||
'TabGroup.h',
|
'TabGroup.h',
|
||||||
'Text.h',
|
'Text.h',
|
||||||
'Timeout.h',
|
'Timeout.h',
|
||||||
|
'TimeoutManager.h',
|
||||||
'TreeWalker.h',
|
'TreeWalker.h',
|
||||||
'WebKitCSSMatrix.h',
|
'WebKitCSSMatrix.h',
|
||||||
'WebSocket.h',
|
'WebSocket.h',
|
||||||
@@ -344,6 +345,7 @@ UNIFIED_SOURCES += [
|
|||||||
'TextInputProcessor.cpp',
|
'TextInputProcessor.cpp',
|
||||||
'ThirdPartyUtil.cpp',
|
'ThirdPartyUtil.cpp',
|
||||||
'Timeout.cpp',
|
'Timeout.cpp',
|
||||||
|
'TimeoutManager.cpp',
|
||||||
'TreeWalker.cpp',
|
'TreeWalker.cpp',
|
||||||
'WebKitCSSMatrix.cpp',
|
'WebKitCSSMatrix.cpp',
|
||||||
'WebSocket.cpp',
|
'WebSocket.cpp',
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/ProcessGlobal.h"
|
#include "mozilla/dom/ProcessGlobal.h"
|
||||||
|
#include "mozilla/dom/TimeoutManager.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsObserverService.h"
|
#include "nsObserverService.h"
|
||||||
#include "nsFocusManager.h"
|
#include "nsFocusManager.h"
|
||||||
@@ -210,7 +211,8 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
|
|||||||
if (elm) {
|
if (elm) {
|
||||||
elm->MarkForCC();
|
elm->MarkForCC();
|
||||||
}
|
}
|
||||||
static_cast<nsGlobalWindow*>(win.get())->UnmarkGrayTimers();
|
static_cast<nsGlobalWindow*>(win.get())->AsInner()->
|
||||||
|
TimeoutManager().UnmarkGrayTimers();
|
||||||
}
|
}
|
||||||
} else if (aPrepareForCC) {
|
} else if (aPrepareForCC) {
|
||||||
// Unfortunately we need to still mark user data just before running CC so
|
// Unfortunately we need to still mark user data just before running CC so
|
||||||
|
|||||||
@@ -574,12 +574,10 @@ nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy
|
|||||||
|
|
||||||
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsContentPermissionRequestProxy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
|
nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(nsContentPermissionRequestProxy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -589,6 +589,15 @@ static nsresult AppendImagePromise(nsITransferable* aTransferable,
|
|||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
NS_ENSURE_TRUE(aImgRequest, NS_OK);
|
NS_ENSURE_TRUE(aImgRequest, NS_OK);
|
||||||
|
|
||||||
|
uint32_t imageStatus;
|
||||||
|
rv = aImgRequest->GetImageStatus(&imageStatus);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
if (!(imageStatus & imgIRequest::STATUS_FRAME_COMPLETE) ||
|
||||||
|
(imageStatus & imgIRequest::STATUS_ERROR)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(aImageElement, &rv);
|
nsCOMPtr<nsINode> node = do_QueryInterface(aImageElement, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|||||||
@@ -791,16 +791,6 @@ nsDOMClassInfo::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMClassInfo::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|
||||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
|
||||||
bool *_retval)
|
|
||||||
{
|
|
||||||
NS_WARNING("nsDOMClassInfo::AddProperty Don't call me!");
|
|
||||||
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMClassInfo::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
nsDOMClassInfo::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
JSObject *obj, jsid id, JS::Value *vp,
|
JSObject *obj, jsid id, JS::Value *vp,
|
||||||
@@ -1964,16 +1954,6 @@ nsEventTargetSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|||||||
return *parentObj ? NS_OK : NS_ERROR_FAILURE;
|
return *parentObj ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsEventTargetSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|
||||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
|
||||||
bool *_retval)
|
|
||||||
{
|
|
||||||
nsEventTargetSH::PreserveWrapper(GetNative(wrapper, obj));
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
|
nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,16 +175,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||||
JSObject *globalObj, JSObject **parentObj) override;
|
JSObject *globalObj, JSObject **parentObj) override;
|
||||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|
||||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
|
||||||
bool *_retval) override;
|
|
||||||
|
|
||||||
virtual void PreserveWrapper(nsISupports *aNative) override;
|
virtual void PreserveWrapper(nsISupports *aNative) override;
|
||||||
|
|
||||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
|
||||||
{
|
|
||||||
return new nsEventTargetSH(aData);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// A place to hang some static methods that we should really consider
|
// A place to hang some static methods that we should really consider
|
||||||
|
|||||||
@@ -1218,13 +1218,11 @@ public:
|
|||||||
explicit SelectorCacheKeyDeleter(SelectorCacheKey* aToDelete)
|
explicit SelectorCacheKeyDeleter(SelectorCacheKey* aToDelete)
|
||||||
: mSelector(aToDelete)
|
: mSelector(aToDelete)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(SelectorCacheKeyDeleter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~SelectorCacheKeyDeleter()
|
~SelectorCacheKeyDeleter()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(SelectorCacheKeyDeleter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -703,6 +703,7 @@ GK_ATOM(onattributechanged, "onattributechanged")
|
|||||||
GK_ATOM(onattributereadreq, "onattributereadreq")
|
GK_ATOM(onattributereadreq, "onattributereadreq")
|
||||||
GK_ATOM(onattributewritereq, "onattributewritereq")
|
GK_ATOM(onattributewritereq, "onattributewritereq")
|
||||||
GK_ATOM(onaudioprocess, "onaudioprocess")
|
GK_ATOM(onaudioprocess, "onaudioprocess")
|
||||||
|
GK_ATOM(onauxclick, "onauxclick")
|
||||||
GK_ATOM(onbeforecopy, "onbeforecopy")
|
GK_ATOM(onbeforecopy, "onbeforecopy")
|
||||||
GK_ATOM(onbeforecut, "onbeforecut")
|
GK_ATOM(onbeforecut, "onbeforecut")
|
||||||
GK_ATOM(onbeforepaste, "onbeforepaste")
|
GK_ATOM(onbeforepaste, "onbeforepaste")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@
|
|||||||
#include "nsSize.h"
|
#include "nsSize.h"
|
||||||
#include "nsCheapSets.h"
|
#include "nsCheapSets.h"
|
||||||
#include "mozilla/dom/ImageBitmapSource.h"
|
#include "mozilla/dom/ImageBitmapSource.h"
|
||||||
#include "mozilla/dom/Timeout.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
||||||
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
||||||
@@ -395,7 +395,6 @@ public:
|
|||||||
virtual void SyncStateFromParentWindow();
|
virtual void SyncStateFromParentWindow();
|
||||||
|
|
||||||
virtual nsresult FireDelayedDOMEvents() override;
|
virtual nsresult FireDelayedDOMEvents() override;
|
||||||
virtual bool IsRunningTimeout() override { return mTimeoutFiringDepth > 0; }
|
|
||||||
|
|
||||||
// Outer windows only.
|
// Outer windows only.
|
||||||
virtual bool WouldReuseInnerWindow(nsIDocument* aNewDocument) override;
|
virtual bool WouldReuseInnerWindow(nsIDocument* aNewDocument) override;
|
||||||
@@ -707,8 +706,6 @@ public:
|
|||||||
|
|
||||||
void AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
void AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||||
|
|
||||||
void UnmarkGrayTimers();
|
|
||||||
|
|
||||||
// Inner windows only.
|
// Inner windows only.
|
||||||
void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||||
void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||||
@@ -1257,6 +1254,7 @@ public:
|
|||||||
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
|
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
|
||||||
|
|
||||||
mozilla::dom::Performance* GetPerformance();
|
mozilla::dom::Performance* GetPerformance();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Web IDL helpers
|
// Web IDL helpers
|
||||||
|
|
||||||
@@ -1465,12 +1463,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Timeout Functions
|
// Timeout Functions
|
||||||
// Language agnostic timeout function (all args passed).
|
|
||||||
// |interval| is in milliseconds.
|
// |interval| is in milliseconds.
|
||||||
nsresult SetTimeoutOrInterval(nsITimeoutHandler* aHandler,
|
|
||||||
int32_t interval, bool aIsInterval,
|
|
||||||
mozilla::dom::Timeout::Reason aReason,
|
|
||||||
int32_t* aReturn);
|
|
||||||
int32_t SetTimeoutOrInterval(JSContext* aCx,
|
int32_t SetTimeoutOrInterval(JSContext* aCx,
|
||||||
mozilla::dom::Function& aFunction,
|
mozilla::dom::Function& aFunction,
|
||||||
int32_t aTimeout,
|
int32_t aTimeout,
|
||||||
@@ -1479,23 +1472,9 @@ public:
|
|||||||
int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
|
int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
|
||||||
int32_t aTimeout, bool aIsInterval,
|
int32_t aTimeout, bool aIsInterval,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
void ClearTimeoutOrInterval(int32_t aTimerId,
|
|
||||||
mozilla::dom::Timeout::Reason aReason);
|
|
||||||
|
|
||||||
// The timeout implementation functions.
|
|
||||||
void RunTimeout(mozilla::dom::Timeout* aTimeout);
|
|
||||||
void RunTimeout() { RunTimeout(nullptr); }
|
|
||||||
// Return true if |aTimeout| was cleared while its handler ran.
|
// Return true if |aTimeout| was cleared while its handler ran.
|
||||||
bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout, nsIScriptContext* aScx);
|
bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout, nsIScriptContext* aScx);
|
||||||
// Return true if |aTimeout| needs to be reinserted into the timeout list.
|
|
||||||
bool RescheduleTimeout(mozilla::dom::Timeout* aTimeout, const TimeStamp& now,
|
|
||||||
bool aRunningPendingTimeouts);
|
|
||||||
|
|
||||||
void ClearAllTimeouts();
|
|
||||||
// Insert aTimeout into the list, before all timeouts that would
|
|
||||||
// fire after it, but no earlier than mTimeoutInsertionPoint, if any.
|
|
||||||
void InsertTimeoutIntoList(mozilla::dom::Timeout* aTimeout);
|
|
||||||
uint32_t GetTimeoutId(mozilla::dom::Timeout::Reason aReason);
|
|
||||||
|
|
||||||
// Helper Functions
|
// Helper Functions
|
||||||
already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner();
|
already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner();
|
||||||
@@ -1617,8 +1596,6 @@ protected:
|
|||||||
|
|
||||||
virtual void UpdateParentTarget() override;
|
virtual void UpdateParentTarget() override;
|
||||||
|
|
||||||
inline int32_t DOMMinTimeoutValue() const;
|
|
||||||
|
|
||||||
void InitializeShowFocusRings();
|
void InitializeShowFocusRings();
|
||||||
|
|
||||||
// Clear the document-dependent slots on our JS wrapper. Inner windows only.
|
// Clear the document-dependent slots on our JS wrapper. Inner windows only.
|
||||||
@@ -1705,22 +1682,6 @@ private:
|
|||||||
friend class nsPIDOMWindow<mozIDOMWindow>;
|
friend class nsPIDOMWindow<mozIDOMWindow>;
|
||||||
friend class nsPIDOMWindow<nsISupports>;
|
friend class nsPIDOMWindow<nsISupports>;
|
||||||
|
|
||||||
// Apply back pressure to the window if the TabGroup ThrottledEventQueue
|
|
||||||
// exists and has too many runnables waiting to run. For example, increase
|
|
||||||
// the minimum timer delay, etc.
|
|
||||||
void
|
|
||||||
MaybeApplyBackPressure();
|
|
||||||
|
|
||||||
// Check the current ThrottledEventQueue depth and update the back pressure
|
|
||||||
// state. If the queue has drained back pressure may be canceled.
|
|
||||||
void
|
|
||||||
CancelOrUpdateBackPressure();
|
|
||||||
|
|
||||||
// When timers are being throttled and we reduce the thottle delay we must
|
|
||||||
// reschedule. The amount of the old throttle delay must be provided in
|
|
||||||
// order to bound how many timers must be examined.
|
|
||||||
nsresult ResetTimersForThrottleReduction(int32_t aPreviousThrottleDelayMS);
|
|
||||||
|
|
||||||
mozilla::dom::TabGroup* TabGroupInner();
|
mozilla::dom::TabGroup* TabGroupInner();
|
||||||
mozilla::dom::TabGroup* TabGroupOuter();
|
mozilla::dom::TabGroup* TabGroupOuter();
|
||||||
|
|
||||||
@@ -1853,17 +1814,6 @@ protected:
|
|||||||
|
|
||||||
// These member variable are used only on inner windows.
|
// These member variable are used only on inner windows.
|
||||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||||
// mTimeouts is generally sorted by mWhen, unless mTimeoutInsertionPoint is
|
|
||||||
// non-null. In that case, the dummy timeout pointed to by
|
|
||||||
// mTimeoutInsertionPoint may have a later mWhen than some of the timeouts
|
|
||||||
// that come after it.
|
|
||||||
mozilla::LinkedList<mozilla::dom::Timeout> mTimeouts;
|
|
||||||
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
|
||||||
// This is a dummy timeout at the moment; if that ever changes, the logic in
|
|
||||||
// ResetTimersForThrottleReduction needs to change.
|
|
||||||
mozilla::dom::Timeout* mTimeoutInsertionPoint;
|
|
||||||
uint32_t mTimeoutIdCounter;
|
|
||||||
uint32_t mTimeoutFiringDepth;
|
|
||||||
RefPtr<mozilla::dom::Location> mLocation;
|
RefPtr<mozilla::dom::Location> mLocation;
|
||||||
RefPtr<nsHistory> mHistory;
|
RefPtr<nsHistory> mHistory;
|
||||||
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
||||||
@@ -1874,11 +1824,10 @@ protected:
|
|||||||
typedef nsTArray<RefPtr<mozilla::dom::StorageEvent>> nsDOMStorageEventArray;
|
typedef nsTArray<RefPtr<mozilla::dom::StorageEvent>> nsDOMStorageEventArray;
|
||||||
nsDOMStorageEventArray mPendingStorageEvents;
|
nsDOMStorageEventArray mPendingStorageEvents;
|
||||||
|
|
||||||
|
|
||||||
uint32_t mSuspendDepth;
|
uint32_t mSuspendDepth;
|
||||||
uint32_t mFreezeDepth;
|
uint32_t mFreezeDepth;
|
||||||
|
|
||||||
int32_t mBackPressureDelayMS;
|
|
||||||
|
|
||||||
// the method that was used to focus mFocusedNode
|
// the method that was used to focus mFocusedNode
|
||||||
uint32_t mFocusMethod;
|
uint32_t mFocusMethod;
|
||||||
|
|
||||||
@@ -1893,8 +1842,6 @@ protected:
|
|||||||
static void InsertIdleCallbackIntoList(mozilla::dom::IdleRequest* aRequest,
|
static void InsertIdleCallbackIntoList(mozilla::dom::IdleRequest* aRequest,
|
||||||
IdleRequests& aList);
|
IdleRequests& aList);
|
||||||
|
|
||||||
// The current idle request callback timeout handle
|
|
||||||
uint32_t mIdleCallbackTimeoutCounter;
|
|
||||||
// The current idle request callback handle
|
// The current idle request callback handle
|
||||||
uint32_t mIdleRequestCallbackCounter;
|
uint32_t mIdleRequestCallbackCounter;
|
||||||
IdleRequests mIdleRequestCallbacks;
|
IdleRequests mIdleRequestCallbacks;
|
||||||
@@ -1974,6 +1921,7 @@ protected:
|
|||||||
friend class nsDOMWindowUtils;
|
friend class nsDOMWindowUtils;
|
||||||
friend class mozilla::dom::PostMessageEvent;
|
friend class mozilla::dom::PostMessageEvent;
|
||||||
friend class DesktopNotification;
|
friend class DesktopNotification;
|
||||||
|
friend class mozilla::dom::TimeoutManager;
|
||||||
|
|
||||||
static WindowByIdTable* sWindowsById;
|
static WindowByIdTable* sWindowsById;
|
||||||
static bool sWarnedAboutWindowInternal;
|
static bool sWarnedAboutWindowInternal;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class Element;
|
|||||||
class Performance;
|
class Performance;
|
||||||
class ServiceWorkerRegistration;
|
class ServiceWorkerRegistration;
|
||||||
class Timeout;
|
class Timeout;
|
||||||
|
class TimeoutManager;
|
||||||
class CustomElementRegistry;
|
class CustomElementRegistry;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
@@ -187,8 +188,6 @@ public:
|
|||||||
return mDoc;
|
return mDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsRunningTimeout() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Lazily instantiate an about:blank document if necessary, and if
|
// Lazily instantiate an about:blank document if necessary, and if
|
||||||
// we have what it takes to do so.
|
// we have what it takes to do so.
|
||||||
@@ -619,6 +618,8 @@ protected:
|
|||||||
|
|
||||||
// mPerformance is only used on inner windows.
|
// mPerformance is only used on inner windows.
|
||||||
RefPtr<mozilla::dom::Performance> mPerformance;
|
RefPtr<mozilla::dom::Performance> mPerformance;
|
||||||
|
// mTimeoutManager is only useed on inner windows.
|
||||||
|
mozilla::UniquePtr<mozilla::dom::TimeoutManager> mTimeoutManager;
|
||||||
|
|
||||||
typedef nsRefPtrHashtable<nsStringHashKey,
|
typedef nsRefPtrHashtable<nsStringHashKey,
|
||||||
mozilla::dom::ServiceWorkerRegistration>
|
mozilla::dom::ServiceWorkerRegistration>
|
||||||
@@ -628,8 +629,6 @@ protected:
|
|||||||
uint32_t mModalStateDepth;
|
uint32_t mModalStateDepth;
|
||||||
|
|
||||||
// These variables are only used on inner windows.
|
// These variables are only used on inner windows.
|
||||||
mozilla::dom::Timeout *mRunningTimeout;
|
|
||||||
|
|
||||||
uint32_t mMutationBits;
|
uint32_t mMutationBits;
|
||||||
|
|
||||||
bool mIsDocumentLoaded;
|
bool mIsDocumentLoaded;
|
||||||
@@ -850,6 +849,12 @@ public:
|
|||||||
// window.
|
// window.
|
||||||
void SyncStateFromParentWindow();
|
void SyncStateFromParentWindow();
|
||||||
|
|
||||||
|
bool HasAudioContexts() const;
|
||||||
|
|
||||||
|
mozilla::dom::TimeoutManager& TimeoutManager();
|
||||||
|
|
||||||
|
bool IsRunningTimeout();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CreatePerformanceObjectIfNeeded();
|
void CreatePerformanceObjectIfNeeded();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,13 +102,11 @@ nsScriptNameSpaceManager::nsScriptNameSpaceManager()
|
|||||||
: mGlobalNames(&hash_table_ops, sizeof(GlobalNameMapEntry),
|
: mGlobalNames(&hash_table_ops, sizeof(GlobalNameMapEntry),
|
||||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH)
|
GLOBALNAME_HASHTABLE_INITIAL_LENGTH)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsScriptNameSpaceManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsScriptNameSpaceManager::~nsScriptNameSpaceManager()
|
nsScriptNameSpaceManager::~nsScriptNameSpaceManager()
|
||||||
{
|
{
|
||||||
UnregisterWeakMemoryReporter(this);
|
UnregisterWeakMemoryReporter(this);
|
||||||
MOZ_COUNT_DTOR(nsScriptNameSpaceManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGlobalNameStruct *
|
nsGlobalNameStruct *
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class ImageData final : public nsISupports
|
|||||||
{
|
{
|
||||||
~ImageData()
|
~ImageData()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(ImageData);
|
|
||||||
DropData();
|
DropData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +34,6 @@ public:
|
|||||||
, mHeight(aHeight)
|
, mHeight(aHeight)
|
||||||
, mData(&aData)
|
, mData(&aData)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ImageData);
|
|
||||||
HoldData();
|
HoldData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,10 @@ EVENT(change,
|
|||||||
eFormChange,
|
eFormChange,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eBasicEventClass)
|
eBasicEventClass)
|
||||||
|
EVENT(auxclick,
|
||||||
|
eMouseAuxClick,
|
||||||
|
EventNameType_All,
|
||||||
|
eMouseEventClass)
|
||||||
EVENT(click,
|
EVENT(click,
|
||||||
eMouseClick,
|
eMouseClick,
|
||||||
EventNameType_All,
|
EventNameType_All,
|
||||||
|
|||||||
@@ -489,6 +489,7 @@ IsMessageMouseUserActivity(EventMessage aMessage)
|
|||||||
return aMessage == eMouseMove ||
|
return aMessage == eMouseMove ||
|
||||||
aMessage == eMouseUp ||
|
aMessage == eMouseUp ||
|
||||||
aMessage == eMouseDown ||
|
aMessage == eMouseDown ||
|
||||||
|
aMessage == eMouseAuxClick ||
|
||||||
aMessage == eMouseDoubleClick ||
|
aMessage == eMouseDoubleClick ||
|
||||||
aMessage == eMouseClick ||
|
aMessage == eMouseClick ||
|
||||||
aMessage == eMouseActivate ||
|
aMessage == eMouseActivate ||
|
||||||
@@ -4617,6 +4618,32 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
|
||||||
|
nsEventStatus* aStatus,
|
||||||
|
EventMessage aMessage,
|
||||||
|
nsIPresShell* aPresShell,
|
||||||
|
nsIContent* aMouseTarget,
|
||||||
|
nsWeakFrame aCurrentTarget,
|
||||||
|
bool aNoContentDispatch)
|
||||||
|
{
|
||||||
|
WidgetMouseEvent event(aEvent->IsTrusted(), aMessage,
|
||||||
|
aEvent->mWidget, WidgetMouseEvent::eReal);
|
||||||
|
|
||||||
|
event.mRefPoint = aEvent->mRefPoint;
|
||||||
|
event.mClickCount = aEvent->mClickCount;
|
||||||
|
event.mModifiers = aEvent->mModifiers;
|
||||||
|
event.buttons = aEvent->buttons;
|
||||||
|
event.mTime = aEvent->mTime;
|
||||||
|
event.mTimeStamp = aEvent->mTimeStamp;
|
||||||
|
event.mFlags.mNoContentDispatch = aNoContentDispatch;
|
||||||
|
event.button = aEvent->button;
|
||||||
|
event.inputSource = aEvent->inputSource;
|
||||||
|
|
||||||
|
return aPresShell->HandleEventWithTarget(&event, aCurrentTarget,
|
||||||
|
aMouseTarget, aStatus);
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
||||||
nsEventStatus* aStatus)
|
nsEventStatus* aStatus)
|
||||||
@@ -4636,17 +4663,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
|||||||
(aEvent->button == WidgetMouseEvent::eMiddleButton ||
|
(aEvent->button == WidgetMouseEvent::eMiddleButton ||
|
||||||
aEvent->button == WidgetMouseEvent::eRightButton);
|
aEvent->button == WidgetMouseEvent::eRightButton);
|
||||||
|
|
||||||
WidgetMouseEvent event(aEvent->IsTrusted(), eMouseClick,
|
bool fireAuxClick = notDispatchToContents;
|
||||||
aEvent->mWidget, WidgetMouseEvent::eReal);
|
|
||||||
event.mRefPoint = aEvent->mRefPoint;
|
|
||||||
event.mClickCount = aEvent->mClickCount;
|
|
||||||
event.mModifiers = aEvent->mModifiers;
|
|
||||||
event.buttons = aEvent->buttons;
|
|
||||||
event.mTime = aEvent->mTime;
|
|
||||||
event.mTimeStamp = aEvent->mTimeStamp;
|
|
||||||
event.mFlags.mNoContentDispatch = notDispatchToContents;
|
|
||||||
event.button = aEvent->button;
|
|
||||||
event.inputSource = aEvent->inputSource;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
|
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
@@ -4665,25 +4682,22 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
|||||||
|
|
||||||
// HandleEvent clears out mCurrentTarget which we might need again
|
// HandleEvent clears out mCurrentTarget which we might need again
|
||||||
nsWeakFrame currentTarget = mCurrentTarget;
|
nsWeakFrame currentTarget = mCurrentTarget;
|
||||||
ret = presShell->HandleEventWithTarget(&event, currentTarget,
|
ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseClick,
|
||||||
mouseContent, aStatus);
|
presShell, mouseContent, currentTarget,
|
||||||
|
notDispatchToContents);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(ret) && aEvent->mClickCount == 2 &&
|
if (NS_SUCCEEDED(ret) && aEvent->mClickCount == 2 &&
|
||||||
mouseContent && mouseContent->IsInComposedDoc()) {
|
mouseContent && mouseContent->IsInComposedDoc()) {
|
||||||
//fire double click
|
//fire double click
|
||||||
WidgetMouseEvent event2(aEvent->IsTrusted(), eMouseDoubleClick,
|
ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseDoubleClick,
|
||||||
aEvent->mWidget, WidgetMouseEvent::eReal);
|
presShell, mouseContent, currentTarget,
|
||||||
event2.mRefPoint = aEvent->mRefPoint;
|
notDispatchToContents);
|
||||||
event2.mClickCount = aEvent->mClickCount;
|
}
|
||||||
event2.mModifiers = aEvent->mModifiers;
|
if (NS_SUCCEEDED(ret) && mouseContent && fireAuxClick &&
|
||||||
event2.buttons = aEvent->buttons;
|
mouseContent->IsInComposedDoc()) {
|
||||||
event2.mTime = aEvent->mTime;
|
ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseAuxClick,
|
||||||
event2.mTimeStamp = aEvent->mTimeStamp;
|
presShell, mouseContent, currentTarget,
|
||||||
event2.mFlags.mNoContentDispatch = notDispatchToContents;
|
false);
|
||||||
event2.button = aEvent->button;
|
|
||||||
event2.inputSource = aEvent->inputSource;
|
|
||||||
|
|
||||||
ret = presShell->HandleEventWithTarget(&event2, currentTarget,
|
|
||||||
mouseContent, aStatus);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,6 +415,13 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void UpdateDragDataTransfer(WidgetDragEvent* dragEvent);
|
void UpdateDragDataTransfer(WidgetDragEvent* dragEvent);
|
||||||
|
|
||||||
|
static nsresult InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
|
||||||
|
nsEventStatus* aStatus,
|
||||||
|
EventMessage aMessage,
|
||||||
|
nsIPresShell* aPresShell,
|
||||||
|
nsIContent* aMouseTarget,
|
||||||
|
nsWeakFrame aCurrentTarget,
|
||||||
|
bool aNoContentDispatch);
|
||||||
nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus);
|
nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus);
|
||||||
nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
|
||||||
nsEventStatus* aStatus);
|
nsEventStatus* aStatus);
|
||||||
@@ -1044,6 +1051,7 @@ private:
|
|||||||
#define NS_EVENT_NEEDS_FRAME(event) \
|
#define NS_EVENT_NEEDS_FRAME(event) \
|
||||||
(!(event)->HasPluginActivationEventMessage() && \
|
(!(event)->HasPluginActivationEventMessage() && \
|
||||||
(event)->mMessage != eMouseClick && \
|
(event)->mMessage != eMouseClick && \
|
||||||
(event)->mMessage != eMouseDoubleClick)
|
(event)->mMessage != eMouseDoubleClick && \
|
||||||
|
(event)->mMessage != eMouseAuxClick)
|
||||||
|
|
||||||
#endif // mozilla_EventStateManager_h_
|
#endif // mozilla_EventStateManager_h_
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
|||||||
case eMouseUp:
|
case eMouseUp:
|
||||||
case eMouseDown:
|
case eMouseDown:
|
||||||
case eMouseDoubleClick:
|
case eMouseDoubleClick:
|
||||||
|
case eMouseAuxClick:
|
||||||
case eMouseClick:
|
case eMouseClick:
|
||||||
case eContextMenu:
|
case eContextMenu:
|
||||||
case eDrop:
|
case eDrop:
|
||||||
|
|||||||
@@ -184,3 +184,4 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
|
|||||||
[test_bug687787.html]
|
[test_bug687787.html]
|
||||||
[test_bug1305458.html]
|
[test_bug1305458.html]
|
||||||
[test_bug1298970.html]
|
[test_bug1298970.html]
|
||||||
|
[test_bug1304044.html]
|
||||||
|
|||||||
133
dom/events/test/test_bug1304044.html
Normal file
133
dom/events/test/test_bug1304044.html
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1304044
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test for Bug 1304044</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
<script type="application/javascript">
|
||||||
|
var eventsFired = [];
|
||||||
|
var target;
|
||||||
|
var eventsExpected;
|
||||||
|
|
||||||
|
function GetNodeString(node) {
|
||||||
|
if (node == window)
|
||||||
|
return "window";
|
||||||
|
if (node == document)
|
||||||
|
return "document";
|
||||||
|
if (node.id)
|
||||||
|
return node.id;
|
||||||
|
if (node.nodeName)
|
||||||
|
return node.nodeName;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TargetAndListener(listener, target) {
|
||||||
|
this.listener = listener;
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetAndListener.prototype.toString = function() {
|
||||||
|
var targetName = GetNodeString(this.target);
|
||||||
|
var listenerName = GetNodeString(this.listener);
|
||||||
|
return "(listener: " + listenerName + ", target: " + targetName + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
var tests = [
|
||||||
|
TestAuxClickBubblesForEventListener,
|
||||||
|
TestAuxClickBubblesForOnAuxClick,
|
||||||
|
];
|
||||||
|
|
||||||
|
function CompareEvents(evt, expected) {
|
||||||
|
return evt && expected && evt.listener == expected.listener &&
|
||||||
|
evt.target == expected.target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResetEventsFired() {
|
||||||
|
eventsFired = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function ClearEventListeners() {
|
||||||
|
for (i in arguments) {
|
||||||
|
arguments[i].removeEventListener("auxclick", log_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ClickTarget(tgt) {
|
||||||
|
synthesizeMouseAtCenter(tgt, {type : "mousedown", button: 2}, window);
|
||||||
|
synthesizeMouseAtCenter(tgt, {type : "mouseup", button: 2}, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
function log_event(e) {
|
||||||
|
eventsFired[eventsFired.length] = new TargetAndListener(this, e.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CompareEventsToExpected(expected, actual) {
|
||||||
|
for (var i = 0; i < expected.length || i < actual.length; i++) {
|
||||||
|
ok(CompareEvents(actual[i], expected[i]),
|
||||||
|
"Auxclick receiver's don't match: TargetAndListener " +
|
||||||
|
i + ": Expected: " + expected[i] + ", Actual: " + actual[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestAuxClickBubblesForEventListener() {
|
||||||
|
target.addEventListener("auxclick", log_event);
|
||||||
|
document.addEventListener("auxclick", log_event);
|
||||||
|
window.addEventListener("auxclick", log_event);
|
||||||
|
|
||||||
|
ClickTarget(target)
|
||||||
|
CompareEventsToExpected(eventsExpected, eventsFired);
|
||||||
|
ResetEventsFired();
|
||||||
|
ClearEventListeners(target, document, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestAuxClickBubblesForOnAuxClick() {
|
||||||
|
target.onauxclick = log_event;
|
||||||
|
document.onauxclick = log_event;
|
||||||
|
window.onauxclick = log_event;
|
||||||
|
|
||||||
|
ClickTarget(target);
|
||||||
|
CompareEventsToExpected(eventsExpected, eventsFired);
|
||||||
|
ResetEventsFired();
|
||||||
|
}
|
||||||
|
|
||||||
|
function RunTests(){
|
||||||
|
for (var i = 0; i < tests.length; i++) {
|
||||||
|
tests[i]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Begin() {
|
||||||
|
target = document.getElementById("target");
|
||||||
|
eventsExpected = [
|
||||||
|
new TargetAndListener(target, target),
|
||||||
|
new TargetAndListener(document, target),
|
||||||
|
new TargetAndListener(window, target),
|
||||||
|
];
|
||||||
|
RunTests();
|
||||||
|
target.remove();
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
SimpleTest.executeSoon(Begin);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1304044">Mozilla Bug 1304044</a>
|
||||||
|
<p id="display">
|
||||||
|
<div id="target">Target</div>
|
||||||
|
</p>
|
||||||
|
<div id="content" style:"display:none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -82,7 +82,7 @@ private:
|
|||||||
mSeekableStream(do_QueryInterface(aStream)),
|
mSeekableStream(do_QueryInterface(aStream)),
|
||||||
mSerializableInputStream(do_QueryInterface(aStream))
|
mSerializableInputStream(do_QueryInterface(aStream))
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mSeekableStream, "Somebody gave us the wrong stream!");
|
MOZ_ASSERT(mSeekableStream, "Somebody gave us the wrong stream!");
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DataOwner> mDataOwner;
|
RefPtr<DataOwner> mDataOwner;
|
||||||
@@ -108,7 +108,7 @@ nsresult DataOwnerAdapter::Create(DataOwner* aDataOwner,
|
|||||||
nsIInputStream** _retval)
|
nsIInputStream** _retval)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ASSERTION(aDataOwner, "Uh ...");
|
MOZ_ASSERT(aDataOwner, "Uh ...");
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStream> stream;
|
nsCOMPtr<nsIInputStream> stream;
|
||||||
|
|
||||||
@@ -672,28 +672,28 @@ NS_IMPL_ISUPPORTS_INHERITED0(BlobImplFile, BlobImpl)
|
|||||||
void
|
void
|
||||||
BlobImplBase::GetName(nsAString& aName) const
|
BlobImplBase::GetName(nsAString& aName) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
aName = mName;
|
aName = mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BlobImplBase::GetPath(nsAString& aPath) const
|
BlobImplBase::GetPath(nsAString& aPath) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
aPath = mPath;
|
aPath = mPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BlobImplBase::SetPath(const nsAString& aPath)
|
BlobImplBase::SetPath(const nsAString& aPath)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
mPath = aPath;
|
mPath = aPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BlobImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) const
|
BlobImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
|
|
||||||
aFileName.Truncate();
|
aFileName.Truncate();
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ BlobImplBase::GetType(nsAString& aType)
|
|||||||
int64_t
|
int64_t
|
||||||
BlobImplBase::GetLastModified(ErrorResult& aRv)
|
BlobImplBase::GetLastModified(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
if (IsDateUnknown()) {
|
if (IsDateUnknown()) {
|
||||||
mLastModificationDate = PR_Now();
|
mLastModificationDate = PR_Now();
|
||||||
}
|
}
|
||||||
@@ -840,7 +840,7 @@ BlobImplFile::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||||||
void
|
void
|
||||||
BlobImplFile::GetMozFullPathInternal(nsAString& aFilename, ErrorResult& aRv) const
|
BlobImplFile::GetMozFullPathInternal(nsAString& aFilename, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
aRv = mFile->GetPath(aFilename);
|
aRv = mFile->GetPath(aFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,7 +848,7 @@ uint64_t
|
|||||||
BlobImplFile::GetSize(ErrorResult& aRv)
|
BlobImplFile::GetSize(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (BlobImplBase::IsSizeUnknown()) {
|
if (BlobImplBase::IsSizeUnknown()) {
|
||||||
NS_ASSERTION(mWholeFile,
|
MOZ_ASSERT(mWholeFile,
|
||||||
"Should only use lazy size when using the whole file");
|
"Should only use lazy size when using the whole file");
|
||||||
int64_t fileSize;
|
int64_t fileSize;
|
||||||
aRv = mFile->GetFileSize(&fileSize);
|
aRv = mFile->GetFileSize(&fileSize);
|
||||||
@@ -907,8 +907,8 @@ BlobImplFile::GetType(nsAString& aType)
|
|||||||
aType.Truncate();
|
aType.Truncate();
|
||||||
|
|
||||||
if (mContentType.IsVoid()) {
|
if (mContentType.IsVoid()) {
|
||||||
NS_ASSERTION(mWholeFile,
|
MOZ_ASSERT(mWholeFile,
|
||||||
"Should only use lazy ContentType when using the whole file");
|
"Should only use lazy ContentType when using the whole file");
|
||||||
|
|
||||||
if (!NS_IsMainThread()) {
|
if (!NS_IsMainThread()) {
|
||||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||||
@@ -952,7 +952,7 @@ BlobImplFile::GetType(nsAString& aType)
|
|||||||
int64_t
|
int64_t
|
||||||
BlobImplFile::GetLastModified(ErrorResult& aRv)
|
BlobImplFile::GetLastModified(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIsFile, "Should only be called on files");
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
if (BlobImplBase::IsDateUnknown()) {
|
if (BlobImplBase::IsDateUnknown()) {
|
||||||
PRTime msecs;
|
PRTime msecs;
|
||||||
aRv = mFile->GetLastModifiedTime(&msecs);
|
aRv = mFile->GetLastModifiedTime(&msecs);
|
||||||
|
|||||||
@@ -394,8 +394,7 @@ public:
|
|||||||
, mLastModificationDate(INT64_MAX)
|
, mLastModificationDate(INT64_MAX)
|
||||||
, mSerialNumber(NextSerialNumber())
|
, mSerialNumber(NextSerialNumber())
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aLength != UINT64_MAX,
|
MOZ_ASSERT(aLength != UINT64_MAX, "Must know length when creating slice");
|
||||||
"Must know length when creating slice");
|
|
||||||
// Ensure non-null mContentType by default
|
// Ensure non-null mContentType by default
|
||||||
mContentType.SetIsVoid(false);
|
mContentType.SetIsVoid(false);
|
||||||
}
|
}
|
||||||
@@ -551,7 +550,7 @@ public:
|
|||||||
: BlobImplBase(aName, aContentType, aLength, aLastModifiedDate)
|
: BlobImplBase(aName, aContentType, aLength, aLastModifiedDate)
|
||||||
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobImplMemory(void* aMemoryBuffer, uint64_t aLength,
|
BlobImplMemory(void* aMemoryBuffer, uint64_t aLength,
|
||||||
@@ -559,7 +558,7 @@ public:
|
|||||||
: BlobImplBase(aContentType, aLength)
|
: BlobImplBase(aContentType, aLength)
|
||||||
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||||
@@ -626,7 +625,7 @@ private:
|
|||||||
: BlobImplBase(aContentType, aOther->mStart + aStart, aLength)
|
: BlobImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||||
, mDataOwner(aOther->mDataOwner)
|
, mDataOwner(aOther->mDataOwner)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
|
||||||
mImmutable = aOther->mImmutable;
|
mImmutable = aOther->mImmutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,7 +682,7 @@ public:
|
|||||||
, mWholeFile(true)
|
, mWholeFile(true)
|
||||||
, mIsTemporary(aTemporary)
|
, mIsTemporary(aTemporary)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFile, "must have file");
|
MOZ_ASSERT(mFile, "must have file");
|
||||||
// Lazily get the content type and size
|
// Lazily get the content type and size
|
||||||
mContentType.SetIsVoid(true);
|
mContentType.SetIsVoid(true);
|
||||||
mFile->GetLeafName(mName);
|
mFile->GetLeafName(mName);
|
||||||
@@ -697,7 +696,7 @@ public:
|
|||||||
, mWholeFile(true)
|
, mWholeFile(true)
|
||||||
, mIsTemporary(false)
|
, mIsTemporary(false)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFile, "must have file");
|
MOZ_ASSERT(mFile, "must have file");
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobImplFile(const nsAString& aName, const nsAString& aContentType,
|
BlobImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||||
@@ -708,7 +707,7 @@ public:
|
|||||||
, mWholeFile(true)
|
, mWholeFile(true)
|
||||||
, mIsTemporary(false)
|
, mIsTemporary(false)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFile, "must have file");
|
MOZ_ASSERT(mFile, "must have file");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create as a file with custom name
|
// Create as a file with custom name
|
||||||
@@ -719,7 +718,7 @@ public:
|
|||||||
, mWholeFile(true)
|
, mWholeFile(true)
|
||||||
, mIsTemporary(false)
|
, mIsTemporary(false)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFile, "must have file");
|
MOZ_ASSERT(mFile, "must have file");
|
||||||
if (aContentType.IsEmpty()) {
|
if (aContentType.IsEmpty()) {
|
||||||
// Lazily get the content type and size
|
// Lazily get the content type and size
|
||||||
mContentType.SetIsVoid(true);
|
mContentType.SetIsVoid(true);
|
||||||
@@ -766,7 +765,7 @@ private:
|
|||||||
, mWholeFile(false)
|
, mWholeFile(false)
|
||||||
, mIsTemporary(false)
|
, mIsTemporary(false)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFile, "must have file");
|
MOZ_ASSERT(mFile, "must have file");
|
||||||
mImmutable = aOther->mImmutable;
|
mImmutable = aOther->mImmutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,23 +61,6 @@ public:
|
|||||||
return mFiles.Clear();
|
return mFiles.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FileList* FromSupports(nsISupports* aSupports)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMFileList> list_qi = do_QueryInterface(aSupports);
|
|
||||||
|
|
||||||
// If this assertion fires the QI implementation for the object in
|
|
||||||
// question doesn't use the nsIDOMFileList pointer as the nsISupports
|
|
||||||
// pointer. That must be fixed, or we'll crash...
|
|
||||||
NS_ASSERTION(list_qi == static_cast<nsIDOMFileList*>(aSupports),
|
|
||||||
"Uh, fix QI!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return static_cast<FileList*>(aSupports);
|
|
||||||
}
|
|
||||||
|
|
||||||
File* Item(uint32_t aIndex) const;
|
File* Item(uint32_t aIndex) const;
|
||||||
|
|
||||||
File* IndexedGetter(uint32_t aIndex, bool& aFound) const;
|
File* IndexedGetter(uint32_t aIndex, bool& aFound) const;
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ FileReader::DoReadData(uint64_t aCount)
|
|||||||
if (mDataFormat == FILE_AS_BINARY) {
|
if (mDataFormat == FILE_AS_BINARY) {
|
||||||
//Continuously update our binary string as data comes in
|
//Continuously update our binary string as data comes in
|
||||||
uint32_t oldLen = mResult.Length();
|
uint32_t oldLen = mResult.Length();
|
||||||
NS_ASSERTION(mResult.Length() == mDataLen, "unexpected mResult length");
|
MOZ_ASSERT(mResult.Length() == mDataLen, "unexpected mResult length");
|
||||||
if (uint64_t(oldLen) + aCount > UINT32_MAX)
|
if (uint64_t(oldLen) + aCount > UINT32_MAX)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
char16_t *buf = nullptr;
|
char16_t *buf = nullptr;
|
||||||
@@ -313,7 +313,7 @@ FileReader::DoReadData(uint64_t aCount)
|
|||||||
uint32_t bytesRead = 0;
|
uint32_t bytesRead = 0;
|
||||||
mAsyncStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
|
mAsyncStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
|
||||||
&bytesRead);
|
&bytesRead);
|
||||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CheckedInt<uint64_t> size = mDataLen;
|
CheckedInt<uint64_t> size = mDataLen;
|
||||||
@@ -334,7 +334,7 @@ FileReader::DoReadData(uint64_t aCount)
|
|||||||
|
|
||||||
uint32_t bytesRead = 0;
|
uint32_t bytesRead = 0;
|
||||||
mAsyncStream->Read(mFileData + mDataLen, aCount, &bytesRead);
|
mAsyncStream->Read(mFileData + mDataLen, aCount, &bytesRead);
|
||||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
|
||||||
}
|
}
|
||||||
|
|
||||||
mDataLen += aCount;
|
mDataLen += aCount;
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ MultipartBlobImpl::InitializeChromeFile(Blob& aBlob,
|
|||||||
const ChromeFilePropertyBag& aBag,
|
const ChromeFilePropertyBag& aBag,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!mImmutable, "Something went wrong ...");
|
MOZ_ASSERT(!mImmutable, "Something went wrong ...");
|
||||||
|
|
||||||
if (mImmutable) {
|
if (mImmutable) {
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||||
@@ -362,7 +362,7 @@ MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
|
|||||||
bool aIsFromNsIFile,
|
bool aIsFromNsIFile,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!mImmutable, "Something went wrong ...");
|
MOZ_ASSERT(!mImmutable, "Something went wrong ...");
|
||||||
if (mImmutable) {
|
if (mImmutable) {
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -809,7 +809,7 @@ nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
|
|||||||
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(uri);
|
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(uri);
|
||||||
nsCOMPtr<nsIPrincipal> principal;
|
nsCOMPtr<nsIPrincipal> principal;
|
||||||
uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
||||||
NS_ASSERTION(info->mPrincipal == principal, "Wrong principal!");
|
MOZ_ASSERT(info->mPrincipal == principal, "Wrong principal!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -886,8 +886,6 @@ nsFontTableProtocolHandler::GetScheme(nsACString &result)
|
|||||||
nsresult
|
nsresult
|
||||||
NS_GetBlobForBlobURI(nsIURI* aURI, BlobImpl** aBlob)
|
NS_GetBlobForBlobURI(nsIURI* aURI, BlobImpl** aBlob)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(IsBlobURI(aURI), "Only call this with blob URIs");
|
|
||||||
|
|
||||||
*aBlob = nullptr;
|
*aBlob = nullptr;
|
||||||
|
|
||||||
DataInfo* info = GetDataInfoFromURI(aURI);
|
DataInfo* info = GetDataInfoFromURI(aURI);
|
||||||
@@ -936,8 +934,6 @@ NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
|
|||||||
nsresult
|
nsresult
|
||||||
NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream)
|
NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(IsMediaStreamURI(aURI), "Only call this with mediastream URIs");
|
|
||||||
|
|
||||||
DataInfo* info = GetDataInfoFromURI(aURI);
|
DataInfo* info = GetDataInfoFromURI(aURI);
|
||||||
if (!info || info->mObjectType != DataInfo::eMediaStream) {
|
if (!info || info->mObjectType != DataInfo::eMediaStream) {
|
||||||
return NS_ERROR_DOM_BAD_URI;
|
return NS_ERROR_DOM_BAD_URI;
|
||||||
@@ -985,8 +981,6 @@ nsFontTableProtocolHandler::NewURI(const nsACString& aSpec,
|
|||||||
nsresult
|
nsresult
|
||||||
NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource)
|
NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(IsMediaSourceURI(aURI), "Only call this with mediasource URIs");
|
|
||||||
|
|
||||||
*aSource = nullptr;
|
*aSource = nullptr;
|
||||||
|
|
||||||
DataInfo* info = GetDataInfoFromURI(aURI);
|
DataInfo* info = GetDataInfoFromURI(aURI);
|
||||||
|
|||||||
@@ -333,8 +333,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DistributedContentList)
|
|||||||
DistributedContentList::DistributedContentList(HTMLContentElement* aHostElement)
|
DistributedContentList::DistributedContentList(HTMLContentElement* aHostElement)
|
||||||
: mParent(aHostElement)
|
: mParent(aHostElement)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(DistributedContentList);
|
|
||||||
|
|
||||||
if (aHostElement->IsInsertionPoint()) {
|
if (aHostElement->IsInsertionPoint()) {
|
||||||
if (aHostElement->MatchedNodes().IsEmpty()) {
|
if (aHostElement->MatchedNodes().IsEmpty()) {
|
||||||
// Fallback content.
|
// Fallback content.
|
||||||
@@ -352,7 +350,6 @@ DistributedContentList::DistributedContentList(HTMLContentElement* aHostElement)
|
|||||||
|
|
||||||
DistributedContentList::~DistributedContentList()
|
DistributedContentList::~DistributedContentList()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(DistributedContentList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ HTMLSourceElement::WouldMatchMediaForDocument(const nsAString& aMedia,
|
|||||||
|
|
||||||
nsCSSParser cssParser;
|
nsCSSParser cssParser;
|
||||||
RefPtr<nsMediaList> mediaList = new nsMediaList();
|
RefPtr<nsMediaList> mediaList = new nsMediaList();
|
||||||
cssParser.ParseMediaList(aMedia, nullptr, 0, mediaList, false);
|
cssParser.ParseMediaList(aMedia, nullptr, 0, mediaList);
|
||||||
|
|
||||||
return pctx && mediaList->Matches(pctx, nullptr);
|
return pctx && mediaList->Matches(pctx, nullptr);
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ HTMLSourceElement::UpdateMediaList(const nsAttrValue* aValue)
|
|||||||
|
|
||||||
nsCSSParser cssParser;
|
nsCSSParser cssParser;
|
||||||
mMediaList = new nsMediaList();
|
mMediaList = new nsMediaList();
|
||||||
cssParser.ParseMediaList(mediaStr, nullptr, 0, mMediaList, false);
|
cssParser.ParseMediaList(mediaStr, nullptr, 0, mMediaList);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
#include "mozilla/dom/DOMRect.h"
|
#include "mozilla/dom/DOMRect.h"
|
||||||
#include "mozilla/dom/ValidityState.h"
|
#include "mozilla/dom/ValidityState.h"
|
||||||
#include "mozilla/dom/ElementInlines.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
|
||||||
class nsDOMTokenList;
|
class nsDOMTokenList;
|
||||||
class nsIDOMHTMLMenuElement;
|
class nsIDOMHTMLMenuElement;
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ MemoryReportRequestChild::MemoryReportRequestChild(
|
|||||||
bool aAnonymize, const MaybeFileDesc& aDMDFile)
|
bool aAnonymize, const MaybeFileDesc& aDMDFile)
|
||||||
: mAnonymize(aAnonymize)
|
: mAnonymize(aAnonymize)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(MemoryReportRequestChild);
|
|
||||||
if (aDMDFile.type() == MaybeFileDesc::TFileDescriptor) {
|
if (aDMDFile.type() == MaybeFileDesc::TFileDescriptor) {
|
||||||
mDMDFile = aDMDFile.get_FileDescriptor();
|
mDMDFile = aDMDFile.get_FileDescriptor();
|
||||||
}
|
}
|
||||||
@@ -253,7 +252,6 @@ MemoryReportRequestChild::MemoryReportRequestChild(
|
|||||||
|
|
||||||
MemoryReportRequestChild::~MemoryReportRequestChild()
|
MemoryReportRequestChild::~MemoryReportRequestChild()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(MemoryReportRequestChild);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IPC sender for remote GC/CC logging.
|
// IPC sender for remote GC/CC logging.
|
||||||
|
|||||||
@@ -1791,6 +1791,7 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
|||||||
ContentParent::ContentParent(ContentParent* aOpener,
|
ContentParent::ContentParent(ContentParent* aOpener,
|
||||||
const nsAString& aRemoteType)
|
const nsAString& aRemoteType)
|
||||||
: nsIContentParent()
|
: nsIContentParent()
|
||||||
|
, mLaunchTS(TimeStamp::Now())
|
||||||
, mOpener(aOpener)
|
, mOpener(aOpener)
|
||||||
, mRemoteType(aRemoteType)
|
, mRemoteType(aRemoteType)
|
||||||
, mIsForBrowser(!mRemoteType.IsEmpty())
|
, mIsForBrowser(!mRemoteType.IsEmpty())
|
||||||
@@ -2505,6 +2506,10 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
|||||||
OptionalURIParams* aUserContentCSSURL,
|
OptionalURIParams* aUserContentCSSURL,
|
||||||
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
|
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
|
||||||
{
|
{
|
||||||
|
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
|
||||||
|
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
|
||||||
|
.ToMilliseconds()));
|
||||||
|
|
||||||
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
||||||
MOZ_ASSERT(io, "No IO service?");
|
MOZ_ASSERT(io, "No IO service?");
|
||||||
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
|
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "mozilla/HalTypes.h"
|
#include "mozilla/HalTypes.h"
|
||||||
#include "mozilla/LinkedList.h"
|
#include "mozilla/LinkedList.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
@@ -1096,6 +1097,7 @@ private:
|
|||||||
// details.
|
// details.
|
||||||
|
|
||||||
GeckoChildProcessHost* mSubprocess;
|
GeckoChildProcessHost* mSubprocess;
|
||||||
|
const TimeStamp mLaunchTS; // used to calculate time to start content process
|
||||||
ContentParent* mOpener;
|
ContentParent* mOpener;
|
||||||
|
|
||||||
nsString mRemoteType;
|
nsString mRemoteType;
|
||||||
|
|||||||
@@ -1079,8 +1079,6 @@ ProcessHangMonitor::ProcessHangMonitor()
|
|||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
MOZ_COUNT_CTOR(ProcessHangMonitor);
|
|
||||||
|
|
||||||
if (XRE_IsContentProcess()) {
|
if (XRE_IsContentProcess()) {
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||||
obs->AddObserver(this, "xpcom-shutdown", false);
|
obs->AddObserver(this, "xpcom-shutdown", false);
|
||||||
@@ -1097,8 +1095,6 @@ ProcessHangMonitor::~ProcessHangMonitor()
|
|||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
MOZ_COUNT_DTOR(ProcessHangMonitor);
|
|
||||||
|
|
||||||
MOZ_ASSERT(sInstance == this);
|
MOZ_ASSERT(sInstance == this);
|
||||||
sInstance = nullptr;
|
sInstance = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#define nsMathMLElement_h
|
#define nsMathMLElement_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/dom/ElementInlines.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "nsMappedAttributeElement.h"
|
#include "nsMappedAttributeElement.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "Link.h"
|
#include "Link.h"
|
||||||
|
|||||||
@@ -30,13 +30,11 @@ public:
|
|||||||
mPrincipal(aPrincipal),
|
mPrincipal(aPrincipal),
|
||||||
mContentType(aContentType)
|
mContentType(aContentType)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(BufferMediaResource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~BufferMediaResource()
|
virtual ~BufferMediaResource()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(BufferMediaResource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ class MediaStreamTrackSourceGetter : public nsISupports
|
|||||||
public:
|
public:
|
||||||
MediaStreamTrackSourceGetter()
|
MediaStreamTrackSourceGetter()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(MediaStreamTrackSourceGetter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual already_AddRefed<dom::MediaStreamTrackSource>
|
virtual already_AddRefed<dom::MediaStreamTrackSource>
|
||||||
@@ -93,7 +92,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual ~MediaStreamTrackSourceGetter()
|
virtual ~MediaStreamTrackSourceGetter()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(MediaStreamTrackSourceGetter);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ FileBlockCache::FileBlockCache()
|
|||||||
mIsWriteScheduled(false),
|
mIsWriteScheduled(false),
|
||||||
mIsOpen(false)
|
mIsOpen(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(FileBlockCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBlockCache::~FileBlockCache()
|
FileBlockCache::~FileBlockCache()
|
||||||
@@ -57,7 +56,6 @@ FileBlockCache::~FileBlockCache()
|
|||||||
mFD = nullptr;
|
mFD = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MOZ_COUNT_DTOR(FileBlockCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -417,7 +417,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
|||||||
, INIT_CANONICAL(mIsVisible, !aOwner->IsHidden())
|
, INIT_CANONICAL(mIsVisible, !aOwner->IsHidden())
|
||||||
, mTelemetryReported(false)
|
, mTelemetryReported(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(MediaDecoder);
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MediaMemoryTracker::AddMediaDecoder(this);
|
MediaMemoryTracker::AddMediaDecoder(this);
|
||||||
|
|
||||||
@@ -516,7 +515,6 @@ MediaDecoder::~MediaDecoder()
|
|||||||
mResourceCallback->Disconnect();
|
mResourceCallback->Disconnect();
|
||||||
MediaMemoryTracker::RemoveMediaDecoder(this);
|
MediaMemoryTracker::RemoveMediaDecoder(this);
|
||||||
UnpinForSeek();
|
UnpinForSeek();
|
||||||
MOZ_COUNT_DTOR(MediaDecoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ public:
|
|||||||
, mSelectedVideoTrackID(TRACK_NONE)
|
, mSelectedVideoTrackID(TRACK_NONE)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_COUNT_CTOR(MediaRecorder::Session);
|
|
||||||
|
|
||||||
uint32_t maxMem = Preferences::GetUint("media.recorder.max_memory",
|
uint32_t maxMem = Preferences::GetUint("media.recorder.max_memory",
|
||||||
MAX_ALLOW_MEMORY_BUFFER);
|
MAX_ALLOW_MEMORY_BUFFER);
|
||||||
@@ -589,7 +588,6 @@ private:
|
|||||||
// Only DestroyRunnable is allowed to delete Session object.
|
// Only DestroyRunnable is allowed to delete Session object.
|
||||||
virtual ~Session()
|
virtual ~Session()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(MediaRecorder::Session);
|
|
||||||
LOG(LogLevel::Debug, ("Session.~Session (%p)", this));
|
LOG(LogLevel::Debug, ("Session.~Session (%p)", this));
|
||||||
CleanupStreams();
|
CleanupStreams();
|
||||||
if (mReadThread) {
|
if (mReadThread) {
|
||||||
|
|||||||
@@ -410,13 +410,11 @@ protected:
|
|||||||
mContentType(aContentType),
|
mContentType(aContentType),
|
||||||
mLoadInBackground(false)
|
mLoadInBackground(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(BaseMediaResource);
|
|
||||||
NS_ASSERTION(!mContentType.IsEmpty(), "Must know content type");
|
NS_ASSERTION(!mContentType.IsEmpty(), "Must know content type");
|
||||||
mURI->GetSpec(mContentURL);
|
mURI->GetSpec(mContentURL);
|
||||||
}
|
}
|
||||||
virtual ~BaseMediaResource()
|
virtual ~BaseMediaResource()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(BaseMediaResource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const nsCString& GetContentType() const override
|
const nsCString& GetContentType() const override
|
||||||
|
|||||||
@@ -23,13 +23,11 @@ MediaShutdownManager::MediaShutdownManager()
|
|||||||
, mIsDoingXPCOMShutDown(false)
|
, mIsDoingXPCOMShutDown(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_COUNT_CTOR(MediaShutdownManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaShutdownManager::~MediaShutdownManager()
|
MediaShutdownManager::~MediaShutdownManager()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_COUNT_DTOR(MediaShutdownManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that we don't use ClearOnShutdown() on this StaticRefPtr, as that
|
// Note that we don't use ClearOnShutdown() on this StaticRefPtr, as that
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ public:
|
|||||||
mLabel(aLabel),
|
mLabel(aLabel),
|
||||||
mStopped(false)
|
mStopped(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(MediaStreamTrackSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +165,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual ~MediaStreamTrackSource()
|
virtual ~MediaStreamTrackSource()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(MediaStreamTrackSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -442,7 +442,11 @@ RTCPeerConnection.prototype = {
|
|||||||
// Warn just once per PeerConnection about deprecated getStats usage.
|
// Warn just once per PeerConnection about deprecated getStats usage.
|
||||||
this._warnDeprecatedStatsAccessNullable = { warn: () =>
|
this._warnDeprecatedStatsAccessNullable = { warn: () =>
|
||||||
this.logWarning("non-maplike pc.getStats access is deprecated! " +
|
this.logWarning("non-maplike pc.getStats access is deprecated! " +
|
||||||
"See http://w3c.github.io/webrtc-pc/#example for usage.") };
|
"See http://w3c.github.io/webrtc-pc/#getstats-example for usage.") };
|
||||||
|
|
||||||
|
this._warnDeprecatedStatsCallbacksNullable = { warn: () =>
|
||||||
|
this.logWarning("Callback-based pc.getStats is deprecated! Use promise-version! " +
|
||||||
|
"See http://w3c.github.io/webrtc-pc/#getstats-example for usage.") };
|
||||||
|
|
||||||
// Add a reference to the PeerConnection to global list (before init).
|
// Add a reference to the PeerConnection to global list (before init).
|
||||||
_globalPCList.addPC(this);
|
_globalPCList.addPC(this);
|
||||||
@@ -1213,6 +1217,11 @@ RTCPeerConnection.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getStats: function(selector, onSucc, onErr) {
|
getStats: function(selector, onSucc, onErr) {
|
||||||
|
if (typeof onSucc == "function" &&
|
||||||
|
this._warnDeprecatedStatsCallbacksNullable.warn) {
|
||||||
|
this._warnDeprecatedStatsCallbacksNullable.warn();
|
||||||
|
this._warnDeprecatedStatsCallbacksNullable.warn = null;
|
||||||
|
}
|
||||||
return this._auto(onSucc, onErr, () => this._getStats(selector));
|
return this._auto(onSucc, onErr, () => this._getStats(selector));
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1490,7 +1499,8 @@ PeerConnectionObserver.prototype = {
|
|||||||
let pc = this._dompc;
|
let pc = this._dompc;
|
||||||
let chromeobj = new RTCStatsReport(pc._win, dict);
|
let chromeobj = new RTCStatsReport(pc._win, dict);
|
||||||
let webidlobj = pc._win.RTCStatsReport._create(pc._win, chromeobj);
|
let webidlobj = pc._win.RTCStatsReport._create(pc._win, chromeobj);
|
||||||
chromeobj.makeStatsPublic(pc._warnDeprecatedStatsAccessNullable);
|
chromeobj.makeStatsPublic(pc._warnDeprecatedStatsCallbacksNullable &&
|
||||||
|
pc._warnDeprecatedStatsAccessNullable);
|
||||||
pc._onGetStatsSuccess(webidlobj);
|
pc._onGetStatsSuccess(webidlobj);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,9 @@ DirectShowDecoder::IsEnabled()
|
|||||||
DirectShowDecoder::DirectShowDecoder(MediaDecoderOwner* aOwner)
|
DirectShowDecoder::DirectShowDecoder(MediaDecoderOwner* aOwner)
|
||||||
: MediaDecoder(aOwner)
|
: MediaDecoder(aOwner)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(DirectShowDecoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectShowDecoder::~DirectShowDecoder()
|
DirectShowDecoder::~DirectShowDecoder() = default;
|
||||||
{
|
|
||||||
MOZ_COUNT_DTOR(DirectShowDecoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ SourceBufferResource::Ended()
|
|||||||
SourceBufferResource::~SourceBufferResource()
|
SourceBufferResource::~SourceBufferResource()
|
||||||
{
|
{
|
||||||
SBR_DEBUG("");
|
SBR_DEBUG("");
|
||||||
MOZ_COUNT_DTOR(SourceBufferResource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceBufferResource::SourceBufferResource(const nsACString& aType)
|
SourceBufferResource::SourceBufferResource(const nsACString& aType)
|
||||||
@@ -177,7 +176,6 @@ SourceBufferResource::SourceBufferResource(const nsACString& aType)
|
|||||||
, mEnded(false)
|
, mEnded(false)
|
||||||
{
|
{
|
||||||
SBR_DEBUG("");
|
SBR_DEBUG("");
|
||||||
MOZ_COUNT_CTOR(SourceBufferResource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SBR_DEBUG
|
#undef SBR_DEBUG
|
||||||
|
|||||||
@@ -1075,15 +1075,12 @@ CamerasParent::CamerasParent()
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
});
|
});
|
||||||
NS_DispatchToMainThread(threadStart);
|
NS_DispatchToMainThread(threadStart);
|
||||||
|
|
||||||
MOZ_COUNT_CTOR(CamerasParent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CamerasParent::~CamerasParent()
|
CamerasParent::~CamerasParent()
|
||||||
{
|
{
|
||||||
LOG(("~CamerasParent: %p", this));
|
LOG(("~CamerasParent: %p", this));
|
||||||
|
|
||||||
MOZ_COUNT_DTOR(CamerasParent);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Verify we have shut down the webrtc engines, this is
|
// Verify we have shut down the webrtc engines, this is
|
||||||
// supposed to happen in ActorDestroy.
|
// supposed to happen in ActorDestroy.
|
||||||
|
|||||||
@@ -19,13 +19,11 @@ BufferDecoder::BufferDecoder(MediaResource* aResource, GMPCrashHelper* aCrashHel
|
|||||||
, mCrashHelper(aCrashHelper)
|
, mCrashHelper(aCrashHelper)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_COUNT_CTOR(BufferDecoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferDecoder::~BufferDecoder()
|
BufferDecoder::~BufferDecoder()
|
||||||
{
|
{
|
||||||
// The dtor may run on any thread, we cannot be sure.
|
// The dtor may run on any thread, we cannot be sure.
|
||||||
MOZ_COUNT_DTOR(BufferDecoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "MediaBufferDecoder.h"
|
#include "MediaBufferDecoder.h"
|
||||||
#include "BufferDecoder.h"
|
#include "BufferDecoder.h"
|
||||||
#include "mozilla/dom/AudioContextBinding.h"
|
#include "mozilla/dom/AudioContextBinding.h"
|
||||||
|
#include "mozilla/dom/DOMException.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include <speex/speex_resampler.h>
|
#include <speex/speex_resampler.h>
|
||||||
#include "nsXPCOMCIDInternal.h"
|
#include "nsXPCOMCIDInternal.h"
|
||||||
@@ -611,7 +612,11 @@ WebAudioDecodeJob::OnFailure(ErrorCode aErrorCode)
|
|||||||
// Ignore errors in calling the callback, since there is not much that we can
|
// Ignore errors in calling the callback, since there is not much that we can
|
||||||
// do about it here.
|
// do about it here.
|
||||||
if (mFailureCallback) {
|
if (mFailureCallback) {
|
||||||
mFailureCallback->Call();
|
nsAutoCString errorString(errorMessage);
|
||||||
|
RefPtr<DOMException> exception =
|
||||||
|
DOMException::Create(NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR,
|
||||||
|
errorString);
|
||||||
|
mFailureCallback->Call(*exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPromise->MaybeReject(NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR);
|
mPromise->MaybeReject(NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR);
|
||||||
|
|||||||
@@ -326,7 +326,9 @@ function runTest(test, response, callback) {
|
|||||||
test.expectedBuffer = asyncResult;
|
test.expectedBuffer = asyncResult;
|
||||||
test.nativeContext = cx;
|
test.nativeContext = cx;
|
||||||
runResampling(test, compressedAudio, callback);
|
runResampling(test, compressedAudio, callback);
|
||||||
}, function onFailure() {
|
}, function onFailure(e) {
|
||||||
|
ok(e instanceof DOMException, "We want to see an exception here");
|
||||||
|
is(e.name, "EncodingError", "Exception name matches");
|
||||||
ok(expectCallback, "Failure callback should fire asynchronously");
|
ok(expectCallback, "Failure callback should fire asynchronously");
|
||||||
ok(!test.valid, "Did expect failure for test " + test.url);
|
ok(!test.valid, "Did expect failure for test " + test.url);
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -29,12 +29,10 @@ RTCIdentityProviderRegistrar::RTCIdentityProviderRegistrar(
|
|||||||
, mGenerateAssertionCallback(nullptr)
|
, mGenerateAssertionCallback(nullptr)
|
||||||
, mValidateAssertionCallback(nullptr)
|
, mValidateAssertionCallback(nullptr)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(RTCIdentityProviderRegistrar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCIdentityProviderRegistrar::~RTCIdentityProviderRegistrar()
|
RTCIdentityProviderRegistrar::~RTCIdentityProviderRegistrar()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(RTCIdentityProviderRegistrar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ struct ParamTraits<mozilla::dom::RTCStatsReportInternal>
|
|||||||
WriteParam(aMsg, aParam.mPcid);
|
WriteParam(aMsg, aParam.mPcid);
|
||||||
WriteParam(aMsg, aParam.mRemoteSdp);
|
WriteParam(aMsg, aParam.mRemoteSdp);
|
||||||
WriteParam(aMsg, aParam.mTimestamp);
|
WriteParam(aMsg, aParam.mTimestamp);
|
||||||
|
WriteParam(aMsg, aParam.mIceRestarts);
|
||||||
|
WriteParam(aMsg, aParam.mIceRollbacks);
|
||||||
WriteParam(aMsg, aParam.mTransportStats);
|
WriteParam(aMsg, aParam.mTransportStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +132,8 @@ struct ParamTraits<mozilla::dom::RTCStatsReportInternal>
|
|||||||
!ReadParam(aMsg, aIter, &(aResult->mPcid)) ||
|
!ReadParam(aMsg, aIter, &(aResult->mPcid)) ||
|
||||||
!ReadParam(aMsg, aIter, &(aResult->mRemoteSdp)) ||
|
!ReadParam(aMsg, aIter, &(aResult->mRemoteSdp)) ||
|
||||||
!ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
|
!ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
|
||||||
|
!ReadParam(aMsg, aIter, &(aResult->mIceRestarts)) ||
|
||||||
|
!ReadParam(aMsg, aIter, &(aResult->mIceRollbacks)) ||
|
||||||
!ReadParam(aMsg, aIter, &(aResult->mTransportStats))) {
|
!ReadParam(aMsg, aIter, &(aResult->mTransportStats))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,14 +103,12 @@ NS_IMPL_RELEASE_INHERITED(Performance, DOMEventTargetHelper)
|
|||||||
/* static */ already_AddRefed<Performance>
|
/* static */ already_AddRefed<Performance>
|
||||||
Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow,
|
Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow,
|
||||||
nsDOMNavigationTiming* aDOMTiming,
|
nsDOMNavigationTiming* aDOMTiming,
|
||||||
nsITimedChannel* aChannel,
|
nsITimedChannel* aChannel)
|
||||||
Performance* aParentPerformance)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
RefPtr<Performance> performance =
|
RefPtr<Performance> performance =
|
||||||
new PerformanceMainThread(aWindow, aDOMTiming, aChannel,
|
new PerformanceMainThread(aWindow, aDOMTiming, aChannel);
|
||||||
aParentPerformance);
|
|
||||||
return performance.forget();
|
return performance.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ public:
|
|||||||
static already_AddRefed<Performance>
|
static already_AddRefed<Performance>
|
||||||
CreateForMainThread(nsPIDOMWindowInner* aWindow,
|
CreateForMainThread(nsPIDOMWindowInner* aWindow,
|
||||||
nsDOMNavigationTiming* aDOMTiming,
|
nsDOMNavigationTiming* aDOMTiming,
|
||||||
nsITimedChannel* aChannel,
|
nsITimedChannel* aChannel);
|
||||||
Performance* aParentPerformance);
|
|
||||||
|
|
||||||
static already_AddRefed<Performance>
|
static already_AddRefed<Performance>
|
||||||
CreateForWorker(workers::WorkerPrivate* aWorkerPrivate);
|
CreateForWorker(workers::WorkerPrivate* aWorkerPrivate);
|
||||||
@@ -104,8 +103,6 @@ public:
|
|||||||
|
|
||||||
virtual nsITimedChannel* GetChannel() const = 0;
|
virtual nsITimedChannel* GetChannel() const = 0;
|
||||||
|
|
||||||
virtual Performance* GetParentPerformance() const = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Performance();
|
Performance();
|
||||||
explicit Performance(nsPIDOMWindowInner* aWindow);
|
explicit Performance(nsPIDOMWindowInner* aWindow);
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(PerformanceMainThread)
|
|||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread,
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread,
|
||||||
Performance)
|
Performance)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTiming,
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTiming,
|
||||||
mNavigation,
|
mNavigation)
|
||||||
mParentPerformance)
|
|
||||||
tmp->mMozMemory = nullptr;
|
tmp->mMozMemory = nullptr;
|
||||||
mozilla::DropJSObjects(this);
|
mozilla::DropJSObjects(this);
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
@@ -25,8 +24,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PerformanceMainThread,
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PerformanceMainThread,
|
||||||
Performance)
|
Performance)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTiming,
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTiming,
|
||||||
mNavigation,
|
mNavigation)
|
||||||
mParentPerformance)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
@@ -46,12 +44,10 @@ NS_INTERFACE_MAP_END_INHERITING(Performance)
|
|||||||
|
|
||||||
PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
||||||
nsDOMNavigationTiming* aDOMTiming,
|
nsDOMNavigationTiming* aDOMTiming,
|
||||||
nsITimedChannel* aChannel,
|
nsITimedChannel* aChannel)
|
||||||
Performance* aParentPerformance)
|
|
||||||
: Performance(aWindow)
|
: Performance(aWindow)
|
||||||
, mDOMTiming(aDOMTiming)
|
, mDOMTiming(aDOMTiming)
|
||||||
, mChannel(aChannel)
|
, mChannel(aChannel)
|
||||||
, mParentPerformance(aParentPerformance)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow, "Parent window object should be provided");
|
MOZ_ASSERT(aWindow, "Parent window object should be provided");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ class PerformanceMainThread final : public Performance
|
|||||||
public:
|
public:
|
||||||
PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
||||||
nsDOMNavigationTiming* aDOMTiming,
|
nsDOMNavigationTiming* aDOMTiming,
|
||||||
nsITimedChannel* aChannel,
|
nsITimedChannel* aChannel);
|
||||||
Performance* aParentPerformance);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread,
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread,
|
||||||
@@ -51,11 +50,6 @@ public:
|
|||||||
return mChannel;
|
return mChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Performance* GetParentPerformance() const override
|
|
||||||
{
|
|
||||||
return mParentPerformance;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~PerformanceMainThread();
|
~PerformanceMainThread();
|
||||||
|
|
||||||
@@ -77,7 +71,6 @@ protected:
|
|||||||
nsCOMPtr<nsITimedChannel> mChannel;
|
nsCOMPtr<nsITimedChannel> mChannel;
|
||||||
RefPtr<PerformanceTiming> mTiming;
|
RefPtr<PerformanceTiming> mTiming;
|
||||||
RefPtr<PerformanceNavigation> mNavigation;
|
RefPtr<PerformanceNavigation> mNavigation;
|
||||||
RefPtr<Performance> mParentPerformance;
|
|
||||||
JS::Heap<JSObject*> mMozMemory;
|
JS::Heap<JSObject*> mMozMemory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -64,12 +64,6 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Performance* GetParentPerformance() const override
|
|
||||||
{
|
|
||||||
MOZ_CRASH("This should not be called on workers.");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~PerformanceWorker();
|
~PerformanceWorker();
|
||||||
|
|
||||||
|
|||||||
@@ -2532,6 +2532,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||||||
NS_ASSERTION(anEvent.mMessage == eMouseDown ||
|
NS_ASSERTION(anEvent.mMessage == eMouseDown ||
|
||||||
anEvent.mMessage == eMouseUp ||
|
anEvent.mMessage == eMouseUp ||
|
||||||
anEvent.mMessage == eMouseDoubleClick ||
|
anEvent.mMessage == eMouseDoubleClick ||
|
||||||
|
anEvent.mMessage == eMouseAuxClick ||
|
||||||
anEvent.mMessage == eMouseOver ||
|
anEvent.mMessage == eMouseOver ||
|
||||||
anEvent.mMessage == eMouseOut ||
|
anEvent.mMessage == eMouseOut ||
|
||||||
anEvent.mMessage == eMouseMove ||
|
anEvent.mMessage == eMouseMove ||
|
||||||
@@ -2594,6 +2595,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||||||
switch (anEvent.mMessage) {
|
switch (anEvent.mMessage) {
|
||||||
case eMouseClick:
|
case eMouseClick:
|
||||||
case eMouseDoubleClick:
|
case eMouseDoubleClick:
|
||||||
|
case eMouseAuxClick:
|
||||||
// Button up/down events sent instead.
|
// Button up/down events sent instead.
|
||||||
return rv;
|
return rv;
|
||||||
default:
|
default:
|
||||||
@@ -2797,6 +2799,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||||||
switch (anEvent.mMessage) {
|
switch (anEvent.mMessage) {
|
||||||
case eMouseClick:
|
case eMouseClick:
|
||||||
case eMouseDoubleClick:
|
case eMouseDoubleClick:
|
||||||
|
case eMouseAuxClick:
|
||||||
// Button up/down events sent instead.
|
// Button up/down events sent instead.
|
||||||
return rv;
|
return rv;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -110,13 +110,10 @@ NS_IMPL_ISUPPORTS(PresentationBuilderParent,
|
|||||||
PresentationBuilderParent::PresentationBuilderParent(PresentationParent* aParent)
|
PresentationBuilderParent::PresentationBuilderParent(PresentationParent* aParent)
|
||||||
: mParent(aParent)
|
: mParent(aParent)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(PresentationBuilderParent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PresentationBuilderParent::~PresentationBuilderParent()
|
PresentationBuilderParent::~PresentationBuilderParent()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(PresentationBuilderParent);
|
|
||||||
|
|
||||||
if (mNeedDestroyActor) {
|
if (mNeedDestroyActor) {
|
||||||
Unused << NS_WARN_IF(!Send__delete__(this));
|
Unused << NS_WARN_IF(!Send__delete__(this));
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user