mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Merge inbound to m-c a=merge CLOSED TREE
--HG-- rename : dom/bluetooth/bluetooth1/BluetoothRilListener.cpp => dom/bluetooth/BluetoothRilListener.cpp
This commit is contained in:
commit
aa6cf3235f
@ -11,6 +11,7 @@
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "XULTreeGridAccessible.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
@ -368,24 +368,31 @@ function test() {
|
||||
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
|
||||
|
||||
newWin = undoCloseWindow(0);
|
||||
newWin.addEventListener("load", function whenloaded() {
|
||||
newWin.removeEventListener("load", whenloaded, false);
|
||||
|
||||
whenNewWindowLoaded({}, function (newWin2) {
|
||||
is(newWin2.gBrowser.browsers.length, 1,
|
||||
"Did not restore, as undoCloseWindow() was last called");
|
||||
is(TEST_URLS.indexOf(newWin2.gBrowser.browsers[0].currentURI.spec), -1,
|
||||
"Did not restore, as undoCloseWindow() was last called (2)");
|
||||
newWin.gBrowser.tabContainer.addEventListener("SSTabRestored", function whenSSTabRestored() {
|
||||
newWin.gBrowser.tabContainer.removeEventListener("SSTabRestored", whenSSTabRestored, false);
|
||||
|
||||
browserWindowsCount([2, 3], "browser windows while running testOpenCloseRestoreFromPopup");
|
||||
whenNewWindowLoaded({}, function (newWin2) {
|
||||
is(newWin2.gBrowser.browsers.length, 1,
|
||||
"Did not restore, as undoCloseWindow() was last called");
|
||||
is(TEST_URLS.indexOf(newWin2.gBrowser.browsers[0].currentURI.spec), -1,
|
||||
"Did not restore, as undoCloseWindow() was last called (2)");
|
||||
|
||||
// Cleanup
|
||||
newWin.close();
|
||||
newWin2.close();
|
||||
browserWindowsCount([2, 3], "browser windows while running testOpenCloseRestoreFromPopup");
|
||||
|
||||
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
|
||||
// Cleanup
|
||||
newWin.close();
|
||||
newWin2.close();
|
||||
|
||||
// Next please
|
||||
executeSoon(nextFn);
|
||||
});
|
||||
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
|
||||
|
||||
// Next please
|
||||
executeSoon(nextFn);
|
||||
});
|
||||
}, false);
|
||||
}, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsEscape.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsError.h"
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
@ -37,10 +37,6 @@ using mozilla::dom::NodeInfo;
|
||||
NodeInfo::~NodeInfo()
|
||||
{
|
||||
mOwnerManager->RemoveNodeInfo(this);
|
||||
|
||||
NS_RELEASE(mInner.mName);
|
||||
NS_IF_RELEASE(mInner.mPrefix);
|
||||
NS_IF_RELEASE(mInner.mExtraName);
|
||||
}
|
||||
|
||||
NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
|
||||
@ -51,12 +47,12 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
|
||||
MOZ_ASSERT(aOwnerManager, "Invalid aOwnerManager");
|
||||
|
||||
// Initialize mInner
|
||||
NS_ADDREF(mInner.mName = aName);
|
||||
NS_IF_ADDREF(mInner.mPrefix = aPrefix);
|
||||
mInner.mName = aName;
|
||||
mInner.mPrefix = aPrefix;
|
||||
mInner.mNamespaceID = aNamespaceID;
|
||||
mInner.mNodeType = aNodeType;
|
||||
mOwnerManager = aOwnerManager;
|
||||
NS_IF_ADDREF(mInner.mExtraName = aExtraName);
|
||||
mInner.mExtraName = aExtraName;
|
||||
|
||||
mDocument = aOwnerManager->GetDocument();
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include "mozilla/dom/NameSpaceConstants.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIDocument;
|
||||
class nsNodeInfoManager;
|
||||
|
||||
@ -263,14 +263,12 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
// These atoms hold pointers to nsGkAtoms members, and are therefore safe
|
||||
// as a non-owning reference.
|
||||
nsIAtom* MOZ_NON_OWNING_REF mName;
|
||||
nsIAtom* MOZ_NON_OWNING_REF mPrefix;
|
||||
nsCOMPtr<nsIAtom> mName;
|
||||
nsCOMPtr<nsIAtom> mPrefix;
|
||||
int32_t mNamespaceID;
|
||||
uint16_t mNodeType; // As defined by nsIDOMNode.nodeType
|
||||
const nsAString* mNameString;
|
||||
nsIAtom* MOZ_NON_OWNING_REF mExtraName; // Only used by PIs and DocTypes
|
||||
nsCOMPtr<nsIAtom> mExtraName; // Only used by PIs and DocTypes
|
||||
};
|
||||
|
||||
// nsNodeInfoManager needs to pass mInner to the hash table.
|
||||
|
@ -115,6 +115,7 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIEditor.h"
|
||||
@ -7391,3 +7392,300 @@ nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
aSurface->Unmap();
|
||||
return surfaceData;
|
||||
}
|
||||
|
||||
mozilla::Modifiers
|
||||
nsContentUtils::GetWidgetModifiers(int32_t aModifiers)
|
||||
{
|
||||
Modifiers result = 0;
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SHIFT) {
|
||||
result |= mozilla::MODIFIER_SHIFT;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CONTROL) {
|
||||
result |= mozilla::MODIFIER_CONTROL;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALT) {
|
||||
result |= mozilla::MODIFIER_ALT;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_META) {
|
||||
result |= mozilla::MODIFIER_META;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALTGRAPH) {
|
||||
result |= mozilla::MODIFIER_ALTGRAPH;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CAPSLOCK) {
|
||||
result |= mozilla::MODIFIER_CAPSLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) {
|
||||
result |= mozilla::MODIFIER_FN;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FNLOCK) {
|
||||
result |= mozilla::MODIFIER_FNLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) {
|
||||
result |= mozilla::MODIFIER_NUMLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) {
|
||||
result |= mozilla::MODIFIER_SCROLLLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOL) {
|
||||
result |= mozilla::MODIFIER_SYMBOL;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) {
|
||||
result |= mozilla::MODIFIER_SYMBOLLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) {
|
||||
result |= mozilla::MODIFIER_OS;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
nsContentUtils::GetWidget(nsIPresShell* aPresShell, nsPoint* aOffset) {
|
||||
if (aPresShell) {
|
||||
nsIFrame* frame = aPresShell->GetRootFrame();
|
||||
if (frame)
|
||||
return frame->GetView()->GetNearestWidget(aOffset);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int16_t
|
||||
nsContentUtils::GetButtonsFlagForButton(int32_t aButton)
|
||||
{
|
||||
switch (aButton) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
return WidgetMouseEvent::eLeftButtonFlag;
|
||||
case WidgetMouseEvent::eMiddleButton:
|
||||
return WidgetMouseEvent::eMiddleButtonFlag;
|
||||
case WidgetMouseEvent::eRightButton:
|
||||
return WidgetMouseEvent::eRightButtonFlag;
|
||||
case 4:
|
||||
return WidgetMouseEvent::e4thButtonFlag;
|
||||
case 5:
|
||||
return WidgetMouseEvent::e5thButtonFlag;
|
||||
default:
|
||||
NS_ERROR("Button not known.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LayoutDeviceIntPoint
|
||||
nsContentUtils::ToWidgetPoint(const CSSPoint& aPoint,
|
||||
const nsPoint& aOffset,
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
return LayoutDeviceIntPoint::FromAppUnitsRounded(
|
||||
CSSPoint::ToAppUnits(aPoint) + aOffset,
|
||||
aPresContext->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
nsView*
|
||||
nsContentUtils::GetViewToDispatchEvent(nsPresContext* presContext,
|
||||
nsIPresShell** presShell)
|
||||
{
|
||||
if (presContext && presShell) {
|
||||
*presShell = presContext->PresShell();
|
||||
if (*presShell) {
|
||||
NS_ADDREF(*presShell);
|
||||
if (nsViewManager* viewManager = (*presShell)->GetViewManager()) {
|
||||
if (nsView* view = viewManager->GetRootView()) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentUtils::SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
|
||||
const nsAString& aType,
|
||||
int32_t aKeyCode,
|
||||
int32_t aCharCode,
|
||||
int32_t aModifiers,
|
||||
uint32_t aAdditionalFlags,
|
||||
bool* aDefaultActionTaken)
|
||||
{
|
||||
// get the widget to send the event to
|
||||
if (!aWidget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
if (aType.EqualsLiteral("keydown"))
|
||||
msg = NS_KEY_DOWN;
|
||||
else if (aType.EqualsLiteral("keyup"))
|
||||
msg = NS_KEY_UP;
|
||||
else if (aType.EqualsLiteral("keypress"))
|
||||
msg = NS_KEY_PRESS;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
WidgetKeyboardEvent event(true, msg, aWidget);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
|
||||
if (msg == NS_KEY_PRESS) {
|
||||
event.keyCode = aCharCode ? 0 : aKeyCode;
|
||||
event.charCode = aCharCode;
|
||||
} else {
|
||||
event.keyCode = aKeyCode;
|
||||
event.charCode = 0;
|
||||
}
|
||||
|
||||
uint32_t locationFlag = (aAdditionalFlags &
|
||||
(nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD | nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT |
|
||||
nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT | nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD));
|
||||
switch (locationFlag) {
|
||||
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
break;
|
||||
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
|
||||
break;
|
||||
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
|
||||
break;
|
||||
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
|
||||
break;
|
||||
default:
|
||||
if (locationFlag != 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
// If location flag isn't set, choose the location from keycode.
|
||||
switch (aKeyCode) {
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD1:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD2:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD3:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD4:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD5:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD6:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD7:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
|
||||
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
|
||||
case nsIDOMKeyEvent::DOM_VK_ADD:
|
||||
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
|
||||
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
|
||||
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
|
||||
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_SHIFT:
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
|
||||
break;
|
||||
default:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
event.refPoint.x = event.refPoint.y = 0;
|
||||
event.time = PR_IntervalNow();
|
||||
if (!(aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
|
||||
event.mFlags.mIsSynthesizedForTests = true;
|
||||
}
|
||||
|
||||
if (aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_PREVENT_DEFAULT) {
|
||||
event.mFlags.mDefaultPrevented = true;
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
nsresult rv = aWidget->DispatchEvent(&event, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aDefaultActionTaken = (status != nsEventStatus_eConsumeNoDefault);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
|
||||
const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
int32_t aButton,
|
||||
int32_t aClickCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
float aPressure,
|
||||
unsigned short aInputSourceArg,
|
||||
bool aToWindow,
|
||||
bool *aPreventDefault,
|
||||
bool aIsSynthesized)
|
||||
{
|
||||
nsPoint offset;
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
bool contextMenuKey = false;
|
||||
if (aType.EqualsLiteral("mousedown"))
|
||||
msg = NS_MOUSE_BUTTON_DOWN;
|
||||
else if (aType.EqualsLiteral("mouseup"))
|
||||
msg = NS_MOUSE_BUTTON_UP;
|
||||
else if (aType.EqualsLiteral("mousemove"))
|
||||
msg = NS_MOUSE_MOVE;
|
||||
else if (aType.EqualsLiteral("mouseover"))
|
||||
msg = NS_MOUSE_ENTER;
|
||||
else if (aType.EqualsLiteral("mouseout"))
|
||||
msg = NS_MOUSE_EXIT;
|
||||
else if (aType.EqualsLiteral("contextmenu")) {
|
||||
msg = NS_CONTEXTMENU;
|
||||
contextMenuKey = (aButton == 0);
|
||||
} else if (aType.EqualsLiteral("MozMouseHittest"))
|
||||
msg = NS_MOUSE_MOZHITTEST;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
|
||||
aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
|
||||
}
|
||||
|
||||
WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
|
||||
contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
|
||||
WidgetMouseEvent::eNormal);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
event.button = aButton;
|
||||
event.buttons = GetButtonsFlagForButton(aButton);
|
||||
event.widget = widget;
|
||||
event.pressure = aPressure;
|
||||
event.inputSource = aInputSourceArg;
|
||||
event.clickCount = aClickCount;
|
||||
event.time = PR_IntervalNow();
|
||||
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;
|
||||
|
||||
nsPresContext* presContext = aPresShell->GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (aToWindow) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
if (!presShell || !view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
|
||||
}
|
||||
if (gfxPrefs::TestEventsAsyncEnabled()) {
|
||||
status = widget->DispatchInputEvent(&event);
|
||||
} else {
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if (aPreventDefault) {
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ class nsScriptObjectTracer;
|
||||
class nsStringBuffer;
|
||||
class nsStringHashKey;
|
||||
class nsTextFragment;
|
||||
class nsView;
|
||||
class nsViewportInfo;
|
||||
class nsWrapperCache;
|
||||
class nsAttrValue;
|
||||
@ -2316,6 +2317,47 @@ public:
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
|
||||
// Helpers shared by the implementations of nsContentUtils methods and
|
||||
// nsIDOMWindowUtils methods.
|
||||
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
|
||||
static nsIWidget* GetWidget(nsIPresShell* aPresShell, nsPoint* aOffset);
|
||||
static int16_t GetButtonsFlagForButton(int32_t aButton);
|
||||
static mozilla::LayoutDeviceIntPoint ToWidgetPoint(const mozilla::CSSPoint& aPoint,
|
||||
const nsPoint& aOffset,
|
||||
nsPresContext* aPresContext);
|
||||
static nsView* GetViewToDispatchEvent(nsPresContext* aPresContext,
|
||||
nsIPresShell** aPresShell);
|
||||
|
||||
/**
|
||||
* Synthesize a key event to the given widget
|
||||
* (see nsIDOMWindowUtils.sendKeyEvent).
|
||||
*/
|
||||
static nsresult SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
|
||||
const nsAString& aType,
|
||||
int32_t aKeyCode,
|
||||
int32_t aCharCode,
|
||||
int32_t aModifiers,
|
||||
uint32_t aAdditionalFlags,
|
||||
bool* aDefaultActionTaken);
|
||||
|
||||
/**
|
||||
* Synthesize a mouse event to the given widget
|
||||
* (see nsIDOMWindowUtils.sendMouseEvent).
|
||||
*/
|
||||
static nsresult SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
|
||||
const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
int32_t aButton,
|
||||
int32_t aClickCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
float aPressure,
|
||||
unsigned short aInputSourceArg,
|
||||
bool aToWindow,
|
||||
bool *aPreventDefault,
|
||||
bool aIsSynthesized);
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsFrame.h"
|
||||
#include "mozilla/layers/ShadowLayers.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
||||
@ -591,53 +592,6 @@ nsDOMWindowUtils::GetPresShellId(uint32_t *aPresShellId)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* static */
|
||||
mozilla::Modifiers
|
||||
nsDOMWindowUtils::GetWidgetModifiers(int32_t aModifiers)
|
||||
{
|
||||
Modifiers result = 0;
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SHIFT) {
|
||||
result |= mozilla::MODIFIER_SHIFT;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CONTROL) {
|
||||
result |= mozilla::MODIFIER_CONTROL;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALT) {
|
||||
result |= mozilla::MODIFIER_ALT;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_META) {
|
||||
result |= mozilla::MODIFIER_META;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALTGRAPH) {
|
||||
result |= mozilla::MODIFIER_ALTGRAPH;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CAPSLOCK) {
|
||||
result |= mozilla::MODIFIER_CAPSLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) {
|
||||
result |= mozilla::MODIFIER_FN;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FNLOCK) {
|
||||
result |= mozilla::MODIFIER_FNLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) {
|
||||
result |= mozilla::MODIFIER_NUMLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) {
|
||||
result |= mozilla::MODIFIER_SCROLLLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOL) {
|
||||
result |= mozilla::MODIFIER_SYMBOL;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) {
|
||||
result |= mozilla::MODIFIER_SYMBOLLOCK;
|
||||
}
|
||||
if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) {
|
||||
result |= mozilla::MODIFIER_OS;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendMouseEvent(const nsAString& aType,
|
||||
float aX,
|
||||
@ -680,52 +634,6 @@ nsDOMWindowUtils::SendMouseEventToWindow(const nsAString& aType,
|
||||
aOptionalArgCount >= 4 ? aIsSynthesized : true);
|
||||
}
|
||||
|
||||
static LayoutDeviceIntPoint
|
||||
ToWidgetPoint(const CSSPoint& aPoint, const nsPoint& aOffset,
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
return LayoutDeviceIntPoint::FromAppUnitsRounded(
|
||||
CSSPoint::ToAppUnits(aPoint) + aOffset,
|
||||
aPresContext->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
static inline int16_t
|
||||
GetButtonsFlagForButton(int32_t aButton)
|
||||
{
|
||||
switch (aButton) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
return WidgetMouseEvent::eLeftButtonFlag;
|
||||
case WidgetMouseEvent::eMiddleButton:
|
||||
return WidgetMouseEvent::eMiddleButtonFlag;
|
||||
case WidgetMouseEvent::eRightButton:
|
||||
return WidgetMouseEvent::eRightButtonFlag;
|
||||
case 4:
|
||||
return WidgetMouseEvent::e4thButtonFlag;
|
||||
case 5:
|
||||
return WidgetMouseEvent::e5thButtonFlag;
|
||||
default:
|
||||
NS_ERROR("Button not known.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsView*
|
||||
nsDOMWindowUtils::GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell)
|
||||
{
|
||||
if (presContext && presShell) {
|
||||
*presShell = presContext->PresShell();
|
||||
if (*presShell) {
|
||||
NS_ADDREF(*presShell);
|
||||
if (nsViewManager* viewManager = (*presShell)->GetViewManager()) {
|
||||
if (nsView* view = viewManager->GetRootView()) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
|
||||
float aX,
|
||||
@ -742,76 +650,10 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
// get the widget to send the event to
|
||||
nsPoint offset;
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
bool contextMenuKey = false;
|
||||
if (aType.EqualsLiteral("mousedown"))
|
||||
msg = NS_MOUSE_BUTTON_DOWN;
|
||||
else if (aType.EqualsLiteral("mouseup"))
|
||||
msg = NS_MOUSE_BUTTON_UP;
|
||||
else if (aType.EqualsLiteral("mousemove"))
|
||||
msg = NS_MOUSE_MOVE;
|
||||
else if (aType.EqualsLiteral("mouseover"))
|
||||
msg = NS_MOUSE_ENTER;
|
||||
else if (aType.EqualsLiteral("mouseout"))
|
||||
msg = NS_MOUSE_EXIT;
|
||||
else if (aType.EqualsLiteral("contextmenu")) {
|
||||
msg = NS_CONTEXTMENU;
|
||||
contextMenuKey = (aButton == 0);
|
||||
} else if (aType.EqualsLiteral("MozMouseHittest"))
|
||||
msg = NS_MOUSE_MOZHITTEST;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
|
||||
aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
|
||||
}
|
||||
|
||||
WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
|
||||
contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
|
||||
WidgetMouseEvent::eNormal);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
event.button = aButton;
|
||||
event.buttons = GetButtonsFlagForButton(aButton);
|
||||
event.widget = widget;
|
||||
event.pressure = aPressure;
|
||||
event.inputSource = aInputSourceArg;
|
||||
event.clickCount = aClickCount;
|
||||
event.time = PR_IntervalNow();
|
||||
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;
|
||||
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (aToWindow) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
if (!presShell || !view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
|
||||
}
|
||||
if (gfxPrefs::TestEventsAsyncEnabled()) {
|
||||
status = widget->DispatchInputEvent(&event);
|
||||
} else {
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if (aPreventDefault) {
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
return nsContentUtils::SendMouseEvent(presShell, aType, aX, aY, aButton,
|
||||
aClickCount, aModifiers, aIgnoreRootScrollFrame, aPressure,
|
||||
aInputSourceArg, aToWindow, aPreventDefault, aIsSynthesized);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -864,9 +706,9 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
|
||||
}
|
||||
|
||||
WidgetPointerEvent event(true, msg, widget);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
|
||||
event.button = aButton;
|
||||
event.buttons = GetButtonsFlagForButton(aButton);
|
||||
event.buttons = nsContentUtils::GetButtonsFlagForButton(aButton);
|
||||
event.widget = widget;
|
||||
event.pressure = aPressure;
|
||||
event.inputSource = aInputSourceArg;
|
||||
@ -885,13 +727,13 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
|
||||
|
||||
nsEventStatus status;
|
||||
if (aToWindow) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
nsView* view = nsContentUtils::GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
if (!presShell || !view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -989,7 +831,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
|
||||
}
|
||||
|
||||
WidgetWheelEvent wheelEvent(true, NS_WHEEL_WHEEL, widget);
|
||||
wheelEvent.modifiers = GetWidgetModifiers(aModifiers);
|
||||
wheelEvent.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
|
||||
wheelEvent.deltaX = aDeltaX;
|
||||
wheelEvent.deltaY = aDeltaY;
|
||||
wheelEvent.deltaZ = aDeltaZ;
|
||||
@ -1009,7 +851,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
wheelEvent.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
wheelEvent.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
|
||||
widget->DispatchAPZAwareEvent(&wheelEvent);
|
||||
|
||||
@ -1136,7 +978,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
WidgetTouchEvent event(true, msg, widget);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
|
||||
event.widget = widget;
|
||||
event.time = PR_Now();
|
||||
|
||||
@ -1147,7 +989,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
||||
event.touches.SetCapacity(aCount);
|
||||
for (uint32_t i = 0; i < aCount; ++i) {
|
||||
LayoutDeviceIntPoint pt =
|
||||
ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
|
||||
nsContentUtils::ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
|
||||
nsRefPtr<Touch> t = new Touch(aIdentifiers[i],
|
||||
pt,
|
||||
nsIntPoint(aRxs[i], aRys[i]),
|
||||
@ -1159,7 +1001,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
||||
nsEventStatus status;
|
||||
if (aToWindow) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
nsView* view = nsContentUtils::GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
|
||||
if (!presShell || !view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1185,100 +1027,10 @@ nsDOMWindowUtils::SendKeyEvent(const nsAString& aType,
|
||||
|
||||
// get the widget to send the event to
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
if (aType.EqualsLiteral("keydown"))
|
||||
msg = NS_KEY_DOWN;
|
||||
else if (aType.EqualsLiteral("keyup"))
|
||||
msg = NS_KEY_UP;
|
||||
else if (aType.EqualsLiteral("keypress"))
|
||||
msg = NS_KEY_PRESS;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
WidgetKeyboardEvent event(true, msg, widget);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
|
||||
if (msg == NS_KEY_PRESS) {
|
||||
event.keyCode = aCharCode ? 0 : aKeyCode;
|
||||
event.charCode = aCharCode;
|
||||
} else {
|
||||
event.keyCode = aKeyCode;
|
||||
event.charCode = 0;
|
||||
}
|
||||
|
||||
uint32_t locationFlag = (aAdditionalFlags &
|
||||
(KEY_FLAG_LOCATION_STANDARD | KEY_FLAG_LOCATION_LEFT |
|
||||
KEY_FLAG_LOCATION_RIGHT | KEY_FLAG_LOCATION_NUMPAD));
|
||||
switch (locationFlag) {
|
||||
case KEY_FLAG_LOCATION_STANDARD:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
break;
|
||||
case KEY_FLAG_LOCATION_LEFT:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
|
||||
break;
|
||||
case KEY_FLAG_LOCATION_RIGHT:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
|
||||
break;
|
||||
case KEY_FLAG_LOCATION_NUMPAD:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
|
||||
break;
|
||||
default:
|
||||
if (locationFlag != 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
// If location flag isn't set, choose the location from keycode.
|
||||
switch (aKeyCode) {
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD1:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD2:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD3:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD4:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD5:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD6:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD7:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
|
||||
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
|
||||
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
|
||||
case nsIDOMKeyEvent::DOM_VK_ADD:
|
||||
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
|
||||
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
|
||||
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
|
||||
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_SHIFT:
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
|
||||
break;
|
||||
default:
|
||||
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
event.refPoint.x = event.refPoint.y = 0;
|
||||
event.time = PR_IntervalNow();
|
||||
if (!(aAdditionalFlags & KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
|
||||
event.mFlags.mIsSynthesizedForTests = true;
|
||||
}
|
||||
|
||||
if (aAdditionalFlags & KEY_FLAG_PREVENT_DEFAULT) {
|
||||
event.mFlags.mDefaultPrevented = true;
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aDefaultActionTaken = (status != nsEventStatus_eConsumeNoDefault);
|
||||
|
||||
return NS_OK;
|
||||
return nsContentUtils::SendKeyEvent(widget, aType, aKeyCode, aCharCode,
|
||||
aModifiers, aAdditionalFlags,
|
||||
aDefaultActionTaken);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1451,11 +1203,7 @@ nsDOMWindowUtils::GetWidget(nsPoint* aOffset)
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
||||
if (presShell) {
|
||||
nsIFrame* frame = presShell->GetRootFrame();
|
||||
if (frame)
|
||||
return frame->GetView()->GetNearestWidget(aOffset);
|
||||
}
|
||||
return nsContentUtils::GetWidget(presShell, aOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1587,7 +1335,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
WidgetSimpleGestureEvent event(true, msg, widget);
|
||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
|
||||
event.direction = aDirection;
|
||||
event.delta = aDelta;
|
||||
event.clickCount = aClickCount;
|
||||
@ -1597,7 +1345,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
|
||||
|
||||
nsEventStatus status;
|
||||
return widget->DispatchEvent(&event, status);
|
||||
@ -3386,7 +3134,7 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
|
||||
nsPoint offset;
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
|
||||
LayoutDeviceIntPoint pt =
|
||||
ToWidgetPoint(CSSPoint(aX, aY), offset, GetPresContext());
|
||||
nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, GetPresContext());
|
||||
nsPoint ptInRoot =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(widget, pt, rootFrame);
|
||||
nsIFrame* targetFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);
|
||||
|
@ -81,8 +81,6 @@ protected:
|
||||
nsIDocument* GetDocument();
|
||||
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
|
||||
|
||||
nsView* GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell);
|
||||
|
||||
NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
@ -129,8 +127,6 @@ protected:
|
||||
bool aIgnoreRootScrollFrame,
|
||||
bool aToWindow,
|
||||
bool* aPreventDefault);
|
||||
|
||||
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef ANDROID
|
||||
|
@ -120,6 +120,7 @@
|
||||
#include "nsIControllerContext.h"
|
||||
#include "nsGlobalWindowCommands.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsIDOMFileList.h"
|
||||
@ -501,7 +502,9 @@ public:
|
||||
private:
|
||||
~nsGlobalWindowObserver() {}
|
||||
|
||||
nsGlobalWindow* mWindow;
|
||||
// This reference is non-owning and safe because it's cleared by
|
||||
// nsGlobalWindow::CleanUp().
|
||||
nsGlobalWindow* MOZ_NON_OWNING_REF mWindow;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsGlobalWindowObserver, nsIObserver, nsIInterfaceRequestor)
|
||||
@ -1143,7 +1146,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
|
||||
mObserver = new nsGlobalWindowObserver(this);
|
||||
if (mObserver) {
|
||||
NS_ADDREF(mObserver);
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
// Watch for online/offline status changes so we can fire events. Use
|
||||
@ -1163,8 +1165,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
// remain frozen until they get an inner window, so freeze this
|
||||
// outer window here.
|
||||
Freeze();
|
||||
|
||||
mObserver = nullptr;
|
||||
}
|
||||
|
||||
// We could have failed the first time through trying
|
||||
@ -1462,7 +1462,6 @@ nsGlobalWindow::CleanUp()
|
||||
// Drop its reference to this dying window, in case for some bogus reason
|
||||
// the object stays around.
|
||||
mObserver->Forget();
|
||||
NS_RELEASE(mObserver);
|
||||
}
|
||||
|
||||
if (mNavigator) {
|
||||
|
@ -1625,7 +1625,7 @@ protected:
|
||||
nsRefPtr<nsDOMWindowUtils> mWindowUtils;
|
||||
nsString mStatus;
|
||||
nsString mDefaultStatus;
|
||||
nsGlobalWindowObserver* mObserver; // Inner windows only.
|
||||
nsRefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
|
||||
nsRefPtr<mozilla::dom::Crypto> mCrypto;
|
||||
nsRefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
||||
nsRefPtr<mozilla::dom::Console> mConsole;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsUnicharInputStream.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIParserUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsITelephonyService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
453
dom/bluetooth/bluetooth2/BluetoothRilListener.cpp
Normal file
453
dom/bluetooth/bluetooth2/BluetoothRilListener.cpp
Normal file
@ -0,0 +1,453 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothRilListener.h"
|
||||
|
||||
#include "BluetoothHfpManager.h"
|
||||
#include "nsIIccService.h"
|
||||
#include "nsIMobileConnectionInfo.h"
|
||||
#include "nsIMobileConnectionService.h"
|
||||
#include "nsITelephonyService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
/**
|
||||
* IccListener
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS(IccListener, nsIIccListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccListener::NotifyIccInfoChanged()
|
||||
{
|
||||
// mOwner would be set to nullptr only in the dtor of BluetoothRilListener
|
||||
NS_ENSURE_TRUE(mOwner, NS_ERROR_FAILURE);
|
||||
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
|
||||
|
||||
hfp->HandleIccInfoChanged(mOwner->mClientId);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccListener::NotifyStkCommand(const nsAString & aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccListener::NotifyStkSessionEnd()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccListener::NotifyCardStateChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
IccListener::Listen(bool aStart)
|
||||
{
|
||||
NS_ENSURE_TRUE(mOwner, false);
|
||||
|
||||
nsCOMPtr<nsIIccService> service =
|
||||
do_GetService(ICC_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(service, false);
|
||||
|
||||
nsCOMPtr<nsIIcc> icc;
|
||||
service->GetIccByServiceId(mOwner->mClientId, getter_AddRefs(icc));
|
||||
NS_ENSURE_TRUE(icc, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = icc->RegisterListener(this);
|
||||
} else {
|
||||
rv = icc->UnregisterListener(this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
void
|
||||
IccListener::SetOwner(BluetoothRilListener *aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* MobileConnectionListener
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS(MobileConnectionListener, nsIMobileConnectionListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyVoiceChanged()
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
NS_ENSURE_TRUE(hfp, NS_OK);
|
||||
|
||||
hfp->HandleVoiceConnectionChanged(mClientId);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyDataChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyDataError(const nsAString & message)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyCFStateChanged(uint16_t action,
|
||||
uint16_t reason,
|
||||
const nsAString& number,
|
||||
uint16_t timeSeconds,
|
||||
uint16_t serviceClass)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyEmergencyCbModeChanged(bool active,
|
||||
uint32_t timeoutMs)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyOtaStatusChanged(const nsAString & status)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyRadioStateChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyClirModeChanged(uint32_t aMode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyLastKnownNetworkChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyLastKnownHomeNetworkChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyNetworkSelectionModeChanged()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
MobileConnectionListener::Listen(bool aStart)
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionService> service =
|
||||
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(service, false);
|
||||
|
||||
nsCOMPtr<nsIMobileConnection> connection;
|
||||
service->GetItemByServiceId(mClientId, getter_AddRefs(connection));
|
||||
NS_ENSURE_TRUE(connection, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = connection->RegisterListener(this);
|
||||
} else {
|
||||
rv = connection->UnregisterListener(this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
/**
|
||||
* TelephonyListener Implementation
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS(TelephonyListener, nsITelephonyListener)
|
||||
|
||||
/**
|
||||
* @param aSend A boolean indicates whether we need to notify headset or not
|
||||
*/
|
||||
nsresult
|
||||
TelephonyListener::HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend)
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
|
||||
|
||||
uint32_t callIndex;
|
||||
uint16_t callState;
|
||||
nsAutoString number;
|
||||
bool isOutgoing;
|
||||
bool isConference;
|
||||
|
||||
aInfo->GetCallIndex(&callIndex);
|
||||
aInfo->GetCallState(&callState);
|
||||
aInfo->GetNumber(number);
|
||||
aInfo->GetIsOutgoing(&isOutgoing);
|
||||
aInfo->GetIsConference(&isConference);
|
||||
|
||||
hfp->HandleCallStateChanged(callIndex, callState, EmptyString(), number,
|
||||
isOutgoing, isConference, aSend);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::CallStateChanged(nsITelephonyCallInfo* aInfo)
|
||||
{
|
||||
return HandleCallInfo(aInfo, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::EnumerateCallState(nsITelephonyCallInfo* aInfo)
|
||||
{
|
||||
return HandleCallInfo(aInfo, false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::NotifyError(uint32_t aServiceId,
|
||||
int32_t aCallIndex,
|
||||
const nsAString& aError)
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
|
||||
|
||||
if (aCallIndex > 0) {
|
||||
// In order to not miss any related call state transition.
|
||||
// It's possible that 3G network signal lost for unknown reason.
|
||||
// If a call is released abnormally, NotifyError() will be called,
|
||||
// instead of CallStateChanged(). We need to reset the call array state
|
||||
// via setting CALL_STATE_DISCONNECTED
|
||||
hfp->HandleCallStateChanged(aCallIndex,
|
||||
nsITelephonyService::CALL_STATE_DISCONNECTED,
|
||||
aError, EmptyString(), false, false, true);
|
||||
BT_WARNING("Reset the call state due to call transition ends abnormally");
|
||||
}
|
||||
|
||||
BT_WARNING(NS_ConvertUTF16toUTF8(aError).get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::ConferenceCallStateChanged(uint16_t aCallState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::EnumerateCallStateComplete()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::SupplementaryServiceNotification(uint32_t aServiceId,
|
||||
int32_t aCallIndex,
|
||||
uint16_t aNotification)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::NotifyConferenceError(const nsAString& aName,
|
||||
const nsAString& aMessage)
|
||||
{
|
||||
BT_WARNING(NS_ConvertUTF16toUTF8(aName).get());
|
||||
BT_WARNING(NS_ConvertUTF16toUTF8(aMessage).get());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
|
||||
const nsAString& aNumber,
|
||||
uint16_t aNumberPresentation,
|
||||
const nsAString& aName,
|
||||
uint16_t aNamePresentation)
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
|
||||
|
||||
hfp->UpdateSecondNumber(aNumber);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
TelephonyListener::Listen(bool aStart)
|
||||
{
|
||||
nsCOMPtr<nsITelephonyService> service =
|
||||
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(service, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = service->RegisterListener(this);
|
||||
} else {
|
||||
rv = service->UnregisterListener(this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
/**
|
||||
* BluetoothRilListener
|
||||
*/
|
||||
BluetoothRilListener::BluetoothRilListener()
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionService> service =
|
||||
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(service);
|
||||
|
||||
// Query number of total clients (sim slots)
|
||||
uint32_t numItems = 0;
|
||||
if (NS_SUCCEEDED(service->GetNumItems(&numItems))) {
|
||||
// Init MobileConnectionListener array and IccInfoListener
|
||||
for (uint32_t i = 0; i < numItems; i++) {
|
||||
mMobileConnListeners.AppendElement(new MobileConnectionListener(i));
|
||||
}
|
||||
}
|
||||
|
||||
mTelephonyListener = new TelephonyListener();
|
||||
mIccListener = new IccListener();
|
||||
mIccListener->SetOwner(this);
|
||||
|
||||
// Probe for available client
|
||||
SelectClient();
|
||||
}
|
||||
|
||||
BluetoothRilListener::~BluetoothRilListener()
|
||||
{
|
||||
mIccListener->SetOwner(nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::Listen(bool aStart)
|
||||
{
|
||||
NS_ENSURE_TRUE(ListenMobileConnAndIccInfo(aStart), false);
|
||||
NS_ENSURE_TRUE(mTelephonyListener->Listen(aStart), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothRilListener::SelectClient()
|
||||
{
|
||||
// Reset mClientId
|
||||
mClientId = mMobileConnListeners.Length();
|
||||
|
||||
nsCOMPtr<nsIMobileConnectionService> service =
|
||||
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(service);
|
||||
|
||||
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
|
||||
nsCOMPtr<nsIMobileConnection> connection;
|
||||
service->GetItemByServiceId(i, getter_AddRefs(connection));
|
||||
if (!connection) {
|
||||
BT_WARNING("%s: Failed to get mobile connection", __FUNCTION__);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMobileConnectionInfo> voiceInfo;
|
||||
connection->GetVoice(getter_AddRefs(voiceInfo));
|
||||
if (!voiceInfo) {
|
||||
BT_WARNING("%s: Failed to get voice connection info", __FUNCTION__);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsString regState;
|
||||
voiceInfo->GetState(regState);
|
||||
if (regState.EqualsLiteral("registered")) {
|
||||
// Found available client
|
||||
mClientId = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
|
||||
{
|
||||
// Stop listening
|
||||
ListenMobileConnAndIccInfo(false);
|
||||
|
||||
/**
|
||||
* aRegistered:
|
||||
* - TRUE: service becomes registered. We were listening to all clients
|
||||
* and one of them becomes available. Select it to listen.
|
||||
* - FALSE: service becomes un-registered. The client we were listening
|
||||
* becomes unavailable. Select another registered one to listen.
|
||||
*/
|
||||
if (aRegistered) {
|
||||
mClientId = aClientId;
|
||||
} else {
|
||||
SelectClient();
|
||||
}
|
||||
|
||||
// Restart listening
|
||||
ListenMobileConnAndIccInfo(true);
|
||||
|
||||
BT_LOGR("%d client %d. new mClientId %d", aRegistered, aClientId,
|
||||
(mClientId < mMobileConnListeners.Length()) ? mClientId : -1);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothRilListener::EnumerateCalls()
|
||||
{
|
||||
nsCOMPtr<nsITelephonyService> service =
|
||||
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(service);
|
||||
|
||||
nsCOMPtr<nsITelephonyListener> listener(
|
||||
do_QueryObject(mTelephonyListener));
|
||||
|
||||
service->EnumerateCalls(listener);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::ListenMobileConnAndIccInfo(bool aStart)
|
||||
{
|
||||
/**
|
||||
* mClientId < number of total clients:
|
||||
* The client with mClientId is available. Start/Stop listening
|
||||
* mobile connection and icc info of this client only.
|
||||
*
|
||||
* mClientId >= number of total clients:
|
||||
* All clients are unavailable. Start/Stop listening mobile
|
||||
* connections of all clients.
|
||||
*/
|
||||
if (mClientId < mMobileConnListeners.Length()) {
|
||||
NS_ENSURE_TRUE(mMobileConnListeners[mClientId]->Listen(aStart), false);
|
||||
NS_ENSURE_TRUE(mIccListener->Listen(aStart), false);
|
||||
} else {
|
||||
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
|
||||
NS_ENSURE_TRUE(mMobileConnListeners[i]->Listen(aStart), false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
1
dom/cache/DBAction.cpp
vendored
1
dom/cache/DBAction.cpp
vendored
@ -153,6 +153,7 @@ DBAction::OpenConnection(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(conn));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
}
|
||||
|
||||
rv = db::InitializeConnection(conn);
|
||||
|
1
dom/cache/QuotaClient.cpp
vendored
1
dom/cache/QuotaClient.cpp
vendored
@ -153,6 +153,7 @@ public:
|
||||
if (isDir) {
|
||||
if (leafName.EqualsLiteral("morgue")) {
|
||||
rv = GetBodyUsage(file, aUsageInfo);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
} else {
|
||||
NS_WARNING("Unknown Cache directory found!");
|
||||
}
|
||||
|
1
dom/cache/TypeUtils.cpp
vendored
1
dom/cache/TypeUtils.cpp
vendored
@ -23,6 +23,7 @@
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIAsyncOutputStream.h"
|
||||
#include "nsIIPCSerializableInputStream.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsURLParsers.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "CameraPreviewMediaStream.h"
|
||||
#include "mozilla/dom/CameraManagerBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "CameraPreferences.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -16,16 +16,18 @@ ElemSizeFromType(GLenum elemType)
|
||||
case LOCAL_GL_BOOL:
|
||||
case LOCAL_GL_FLOAT:
|
||||
case LOCAL_GL_INT:
|
||||
case LOCAL_GL_INT_SAMPLER_2D:
|
||||
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_INT_SAMPLER_3D:
|
||||
case LOCAL_GL_INT_SAMPLER_CUBE:
|
||||
case LOCAL_GL_UNSIGNED_INT:
|
||||
case LOCAL_GL_SAMPLER_2D:
|
||||
case LOCAL_GL_SAMPLER_3D:
|
||||
case LOCAL_GL_SAMPLER_CUBE:
|
||||
case LOCAL_GL_SAMPLER_2D_SHADOW:
|
||||
case LOCAL_GL_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
case LOCAL_GL_SAMPLER_2D_SHADOW:
|
||||
case LOCAL_GL_SAMPLER_CUBE:
|
||||
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
|
||||
case LOCAL_GL_INT_SAMPLER_2D:
|
||||
case LOCAL_GL_INT_SAMPLER_3D:
|
||||
case LOCAL_GL_INT_SAMPLER_CUBE:
|
||||
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
@ -35,18 +37,20 @@ ElemSizeFromType(GLenum elemType)
|
||||
case LOCAL_GL_BOOL_VEC2:
|
||||
case LOCAL_GL_FLOAT_VEC2:
|
||||
case LOCAL_GL_INT_VEC2:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC2:
|
||||
return 2;
|
||||
|
||||
case LOCAL_GL_BOOL_VEC3:
|
||||
case LOCAL_GL_FLOAT_VEC3:
|
||||
case LOCAL_GL_INT_VEC3:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC3:
|
||||
return 3;
|
||||
|
||||
|
||||
case LOCAL_GL_BOOL_VEC4:
|
||||
case LOCAL_GL_FLOAT_MAT2:
|
||||
case LOCAL_GL_FLOAT_VEC4:
|
||||
case LOCAL_GL_INT_VEC4:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC4:
|
||||
case LOCAL_GL_FLOAT_MAT2:
|
||||
return 4;
|
||||
|
||||
case LOCAL_GL_FLOAT_MAT2x3:
|
||||
|
@ -213,7 +213,20 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
|
||||
case LOCAL_GL_INT_VEC3:
|
||||
case LOCAL_GL_INT_VEC4:
|
||||
case LOCAL_GL_SAMPLER_2D:
|
||||
case LOCAL_GL_SAMPLER_3D:
|
||||
case LOCAL_GL_SAMPLER_CUBE:
|
||||
case LOCAL_GL_SAMPLER_2D_SHADOW:
|
||||
case LOCAL_GL_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
|
||||
case LOCAL_GL_INT_SAMPLER_2D:
|
||||
case LOCAL_GL_INT_SAMPLER_3D:
|
||||
case LOCAL_GL_INT_SAMPLER_CUBE:
|
||||
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
{
|
||||
GLint buffer[kMaxElemSize] = {0};
|
||||
gl->fGetUniformiv(prog, mLoc, buffer);
|
||||
@ -260,6 +273,12 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
|
||||
case LOCAL_GL_FLOAT_MAT2:
|
||||
case LOCAL_GL_FLOAT_MAT3:
|
||||
case LOCAL_GL_FLOAT_MAT4:
|
||||
case LOCAL_GL_FLOAT_MAT2x3:
|
||||
case LOCAL_GL_FLOAT_MAT2x4:
|
||||
case LOCAL_GL_FLOAT_MAT3x2:
|
||||
case LOCAL_GL_FLOAT_MAT3x4:
|
||||
case LOCAL_GL_FLOAT_MAT4x2:
|
||||
case LOCAL_GL_FLOAT_MAT4x3:
|
||||
{
|
||||
GLfloat buffer[16] = {0.0f};
|
||||
gl->fGetUniformfv(prog, mLoc, buffer);
|
||||
@ -275,6 +294,25 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
|
||||
case LOCAL_GL_UNSIGNED_INT:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC2:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC3:
|
||||
case LOCAL_GL_UNSIGNED_INT_VEC4:
|
||||
{
|
||||
GLuint buffer[kMaxElemSize] = {0};
|
||||
gl->fGetUniformuiv(prog, mLoc, buffer);
|
||||
|
||||
if (elemSize == 1)
|
||||
return JS::DoubleValue(buffer[0]); // This is Double because only Int32 is special cased.
|
||||
|
||||
JSObject* obj = dom::Uint32Array::Create(js, webgl, elemSize, buffer);
|
||||
if (!obj) {
|
||||
webgl->ErrorOutOfMemory("getUniform: out of memory");
|
||||
return JS::NullValue();
|
||||
}
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
|
||||
default:
|
||||
MOZ_CRASH("Invalid elemType.");
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsXULAppAPI.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/dom/HTMLFieldSetElement.h"
|
||||
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIFormAutofillContentService.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// form submission
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "mozilla/dom/HTMLLabelElementBinding.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// construction, destruction
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "nsIThreadInternal.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// Include this last to avoid path problems on Windows.
|
||||
#include "ActorsChild.h"
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
@ -275,6 +275,9 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
|
||||
Stringify(aOldScreenSize).c_str(), Stringify(mInnerSize).c_str());
|
||||
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
if (!document) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(document, mInnerSize);
|
||||
uint32_t presShellId = 0;
|
||||
@ -2114,7 +2117,7 @@ bool
|
||||
TabChild::RecvHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId)
|
||||
{
|
||||
if (mGlobal && mTabChildGlobal) {
|
||||
mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aModifiers, aGuid,
|
||||
mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, GetPresShellResolution());
|
||||
}
|
||||
return true;
|
||||
@ -2165,7 +2168,7 @@ TabChild::RecvMouseEvent(const nsString& aType,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aIgnoreRootScrollFrame)
|
||||
{
|
||||
APZCCallbackHelper::DispatchMouseEvent(GetDOMWindowUtils(), aType, CSSPoint(aX, aY),
|
||||
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType, CSSPoint(aX, aY),
|
||||
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
|
||||
return true;
|
||||
}
|
||||
@ -2328,7 +2331,7 @@ TabChild::FireContextMenuEvent()
|
||||
|
||||
MOZ_ASSERT(mTapHoldTimer && mActivePointerId >= 0);
|
||||
bool defaultPrevented = APZCCallbackHelper::DispatchMouseEvent(
|
||||
GetDOMWindowUtils(),
|
||||
GetPresShell(),
|
||||
NS_LITERAL_STRING("contextmenu"),
|
||||
mGestureDownPoint / CSSToLayoutDeviceScale(scale),
|
||||
2 /* Right button */,
|
||||
@ -2526,11 +2529,9 @@ TabChild::RecvKeyEvent(const nsString& aType,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aPreventDefault)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
NS_ENSURE_TRUE(utils, true);
|
||||
bool ignored = false;
|
||||
utils->SendKeyEvent(aType, aKeyCode, aCharCode,
|
||||
aModifiers, aPreventDefault, &ignored);
|
||||
nsContentUtils::SendKeyEvent(mWidget, aType, aKeyCode, aCharCode,
|
||||
aModifiers, aPreventDefault, &ignored);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -354,12 +354,16 @@ IsMP4SupportedType(const nsACString& aType,
|
||||
// For other normal MP4, it still uses current omx decoder.
|
||||
// Bug 1061034 is a follow-up bug to enable all MP4s with MOZ_FMP4
|
||||
#ifdef MOZ_OMX_DECODER
|
||||
return false;
|
||||
#else
|
||||
// Use MP4Decoder when blank-decoder is enabled so that we can run EME
|
||||
// mochitests on B2G platforms. This will be removed once bug 1146729 is
|
||||
// fixed when we don't need blank-decoder to play mp4 on B2G.
|
||||
if (!Preferences::GetBool("media.fragmented-mp4.use-blank-decoder", false)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
bool haveAAC, haveMP3, haveH264;
|
||||
return Preferences::GetBool("media.fragmented-mp4.exposed", false) &&
|
||||
MP4Decoder::CanHandleMediaType(aType, aCodecs, haveAAC, haveH264, haveMP3);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsIStringEnumerator.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsTArray.h"
|
||||
#include "GetUserMediaRequest.h"
|
||||
|
@ -36,10 +36,10 @@ EMEVideoDecoder::GetNodeId()
|
||||
return mProxy->GetNodeId();
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr
|
||||
GMPUniquePtr<GMPVideoEncodedFrame>
|
||||
EMEVideoDecoder::CreateFrame(MediaRawData* aSample)
|
||||
{
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = GMPVideoDecoder::CreateFrame(aSample);
|
||||
GMPUniquePtr<GMPVideoEncodedFrame> frame = GMPVideoDecoder::CreateFrame(aSample);
|
||||
if (frame && aSample->mCrypto.mValid) {
|
||||
static_cast<gmp::GMPVideoEncodedFrameImpl*>(frame.get())->InitCrypto(aSample->mCrypto);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
private:
|
||||
virtual void InitTags(nsTArray<nsCString>& aTags) override;
|
||||
virtual nsCString GetNodeId() override;
|
||||
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample) override;
|
||||
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample) override;
|
||||
|
||||
nsRefPtr<CDMProxy> mProxy;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ extern bool IsOnGMPThread();
|
||||
void
|
||||
VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame)
|
||||
{
|
||||
GMPUnique<GMPVideoi420Frame>::Ptr decodedFrame(aDecodedFrame);
|
||||
GMPUniquePtr<GMPVideoi420Frame> decodedFrame(aDecodedFrame);
|
||||
|
||||
MOZ_ASSERT(IsOnGMPThread());
|
||||
|
||||
@ -115,7 +115,7 @@ GMPVideoDecoder::GetNodeId()
|
||||
return NS_LITERAL_CSTRING("");
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr
|
||||
GMPUniquePtr<GMPVideoEncodedFrame>
|
||||
GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
|
||||
{
|
||||
GMPVideoFrame* ftmp = nullptr;
|
||||
@ -125,7 +125,7 @@ GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
GMPUniquePtr<GMPVideoEncodedFrame> frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
err = frame->CreateEmptyFrame(aSample->mSize);
|
||||
if (GMP_FAILED(err)) {
|
||||
mCallback->Error();
|
||||
@ -248,7 +248,7 @@ GMPVideoDecoder::Input(MediaRawData* aSample)
|
||||
|
||||
mAdapter->SetLastStreamOffset(sample->mOffset);
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = CreateFrame(sample);
|
||||
GMPUniquePtr<GMPVideoEncodedFrame> frame = CreateFrame(sample);
|
||||
nsTArray<uint8_t> info; // No codec specific per-frame info to pass.
|
||||
nsresult rv = mGMP->Decode(Move(frame), false, info, 0);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
protected:
|
||||
virtual void InitTags(nsTArray<nsCString>& aTags);
|
||||
virtual nsCString GetNodeId();
|
||||
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample);
|
||||
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
|
||||
|
||||
private:
|
||||
class GMPInitDoneRunnable : public nsRunnable
|
||||
|
@ -27,13 +27,14 @@ WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
|
||||
: mTaskQueue(aTaskQueue)
|
||||
, mCallback(aCallback)
|
||||
, mMFTManager(aMFTManager)
|
||||
, mMonitor("WMFMediaDataDecoder")
|
||||
, mIsDecodeTaskDispatched(false)
|
||||
, mIsFlushing(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WMFMediaDataDecoder);
|
||||
}
|
||||
|
||||
WMFMediaDataDecoder::~WMFMediaDataDecoder()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WMFMediaDataDecoder);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -48,11 +49,13 @@ WMFMediaDataDecoder::Init()
|
||||
nsresult
|
||||
WMFMediaDataDecoder::Shutdown()
|
||||
{
|
||||
DebugOnly<nsresult> rv = mTaskQueue->FlushAndDispatch(
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
|
||||
#ifdef DEBUG
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("WMFMediaDataDecoder::Shutdown() dispatch of task failed!");
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
// The MP4Reader should have flushed before calling Shutdown().
|
||||
MOZ_ASSERT(!mIsDecodeTaskDispatched);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
@ -61,36 +64,73 @@ WMFMediaDataDecoder::Shutdown()
|
||||
void
|
||||
WMFMediaDataDecoder::ProcessShutdown()
|
||||
{
|
||||
mMFTManager->Shutdown();
|
||||
mMFTManager = nullptr;
|
||||
if (mMFTManager) {
|
||||
mMFTManager->Shutdown();
|
||||
mMFTManager = nullptr;
|
||||
}
|
||||
mDecoder = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
WMFMediaDataDecoder::EnsureDecodeTaskDispatched()
|
||||
{
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
if (!mIsDecodeTaskDispatched) {
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethod(this,
|
||||
&WMFMediaDataDecoder::Decode));
|
||||
mIsDecodeTaskDispatched = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Inserts data into the decoder's pipeline.
|
||||
nsresult
|
||||
WMFMediaDataDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethodWithArg<nsRefPtr<MediaRawData>>(
|
||||
this,
|
||||
&WMFMediaDataDecoder::ProcessDecode,
|
||||
nsRefPtr<MediaRawData>(aSample)));
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mInput.push(aSample);
|
||||
EnsureDecodeTaskDispatched();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample)
|
||||
WMFMediaDataDecoder::Decode()
|
||||
{
|
||||
HRESULT hr = mMFTManager->Input(aSample);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("MFTManager rejected sample");
|
||||
mCallback->Error();
|
||||
return;
|
||||
while (true) {
|
||||
nsRefPtr<MediaRawData> input;
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
MOZ_ASSERT(mIsDecodeTaskDispatched);
|
||||
if (mInput.empty()) {
|
||||
if (mIsFlushing) {
|
||||
if (mDecoder) {
|
||||
mDecoder->Flush();
|
||||
}
|
||||
mIsFlushing = false;
|
||||
}
|
||||
mIsDecodeTaskDispatched = false;
|
||||
mon.NotifyAll();
|
||||
return;
|
||||
}
|
||||
input = mInput.front();
|
||||
mInput.pop();
|
||||
}
|
||||
|
||||
HRESULT hr = mMFTManager->Input(input);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("MFTManager rejected sample");
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
PurgeInputQueue();
|
||||
}
|
||||
mCallback->Error();
|
||||
return;
|
||||
}
|
||||
|
||||
mLastStreamOffset = input->mOffset;
|
||||
|
||||
ProcessOutput();
|
||||
}
|
||||
|
||||
mLastStreamOffset = aSample->mOffset;
|
||||
|
||||
ProcessOutput();
|
||||
}
|
||||
|
||||
void
|
||||
@ -108,24 +148,33 @@ WMFMediaDataDecoder::ProcessOutput()
|
||||
}
|
||||
} else if (FAILED(hr)) {
|
||||
NS_WARNING("WMFMediaDataDecoder failed to output data");
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
PurgeInputQueue();
|
||||
}
|
||||
mCallback->Error();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WMFMediaDataDecoder::PurgeInputQueue()
|
||||
{
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
while (!mInput.empty()) {
|
||||
mInput.pop();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
WMFMediaDataDecoder::Flush()
|
||||
{
|
||||
// Flush the input task queue. This cancels all pending Decode() calls.
|
||||
// Note this blocks until the task queue finishes its current job, if
|
||||
// it's executing at all. Note the MP4Reader ignores all output while
|
||||
// flushing.
|
||||
mTaskQueue->Flush();
|
||||
|
||||
// Order the MFT to flush; drop all internal data.
|
||||
NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE);
|
||||
HRESULT hr = mDecoder->Flush();
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
|
||||
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
PurgeInputQueue();
|
||||
mIsFlushing = true;
|
||||
EnsureDecodeTaskDispatched();
|
||||
while (mIsDecodeTaskDispatched || mIsFlushing) {
|
||||
mon.Wait();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// Called on the task queue. Inserts the sample into the decoder, and
|
||||
// extracts output if available.
|
||||
void ProcessDecode(MediaRawData* aSample);
|
||||
void Decode();
|
||||
void EnsureDecodeTaskDispatched();
|
||||
void PurgeInputQueue();
|
||||
|
||||
// Called on the task queue. Extracts output if available, and delivers
|
||||
// it to the reader. Called after ProcessDecode() and ProcessDrain().
|
||||
@ -97,6 +97,11 @@ private:
|
||||
// The last offset into the media resource that was passed into Input().
|
||||
// This is used to approximate the decoder's position in the media resource.
|
||||
int64_t mLastStreamOffset;
|
||||
|
||||
Monitor mMonitor;
|
||||
std::queue<nsRefPtr<MediaRawData>> mInput;
|
||||
bool mIsDecodeTaskDispatched;
|
||||
bool mIsFlushing;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -310,6 +310,10 @@ GMPChild::PreLoadLibraries(const std::string& aPluginPath)
|
||||
{
|
||||
"d3d9.dll", // Create an `IDirect3D9` to get adapter information
|
||||
"dxva2.dll", // Get monitor information
|
||||
"evr.dll", // MFGetStrideForBitmapInfoHeader
|
||||
"mfh264dec.dll", // H.264 decoder (on Windows Vista)
|
||||
"mfheaacdec.dll", // AAC decoder (on Windows Vista)
|
||||
"mfplat.dll", // MFCreateSample, MFCreateAlignedMemoryBuffer, MFCreateMediaType
|
||||
"msauddecmft.dll", // AAC decoder (on Windows 8)
|
||||
"msmpeg2adec.dll", // AAC decoder (on Windows 7)
|
||||
"msmpeg2vdec.dll", // H.264 decoder
|
||||
|
@ -18,11 +18,8 @@ struct DestroyPolicy
|
||||
}
|
||||
};
|
||||
|
||||
// Ideally, this would be a template alias, but GCC 4.6 doesn't support them. See bug 1124021.
|
||||
template<typename T>
|
||||
struct GMPUnique {
|
||||
typedef mozilla::UniquePtr<T, DestroyPolicy<T>> Ptr;
|
||||
};
|
||||
using GMPUniquePtr = mozilla::UniquePtr<T, DestroyPolicy<T>>;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -109,7 +109,7 @@ GMPVideoDecoderParent::InitDecode(const GMPVideoCodec& aCodecSettings,
|
||||
}
|
||||
|
||||
nsresult
|
||||
GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
GMPVideoDecoderParent::Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs)
|
||||
@ -121,7 +121,7 @@ GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
|
||||
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrameImpl>::Ptr inputFrameImpl(
|
||||
GMPUniquePtr<GMPVideoEncodedFrameImpl> inputFrameImpl(
|
||||
static_cast<GMPVideoEncodedFrameImpl*>(aInputFrame.release()));
|
||||
|
||||
// Very rough kill-switch if the plugin stops processing. If it's merely
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
const nsTArray<uint8_t>& aCodecSpecific,
|
||||
GMPVideoDecoderCallbackProxy* aCallback,
|
||||
int32_t aCoreCount) override;
|
||||
virtual nsresult Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
virtual nsresult Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) override;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
const nsTArray<uint8_t>& aCodecSpecific,
|
||||
GMPVideoDecoderCallbackProxy* aCallback,
|
||||
int32_t aCoreCount) = 0;
|
||||
virtual nsresult Decode(mozilla::GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
virtual nsresult Decode(mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) = 0;
|
||||
|
@ -126,7 +126,7 @@ GMPVideoEncoderParent::InitEncode(const GMPVideoCodec& aCodecSettings,
|
||||
}
|
||||
|
||||
GMPErr
|
||||
GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
GMPVideoEncoderParent::Encode(GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes)
|
||||
{
|
||||
@ -137,7 +137,7 @@ GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
|
||||
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||
|
||||
GMPUnique<GMPVideoi420FrameImpl>::Ptr inputFrameImpl(
|
||||
GMPUniquePtr<GMPVideoi420FrameImpl> inputFrameImpl(
|
||||
static_cast<GMPVideoi420FrameImpl*>(aInputFrame.release()));
|
||||
|
||||
// Very rough kill-switch if the plugin stops processing. If it's merely
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
GMPVideoEncoderCallbackProxy* aCallback,
|
||||
int32_t aNumberOfCores,
|
||||
uint32_t aMaxPayloadSize) override;
|
||||
virtual GMPErr Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
virtual GMPErr Encode(GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes) override;
|
||||
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
GMPVideoEncoderCallbackProxy* aCallback,
|
||||
int32_t aNumberOfCores,
|
||||
uint32_t aMaxPayloadSize) = 0;
|
||||
virtual GMPErr Encode(mozilla::GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
virtual GMPErr Encode(mozilla::GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes) = 0;
|
||||
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) = 0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/MediaManager.h"
|
||||
#include "prlog.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#undef LOG
|
||||
#if defined(PR_LOGGING)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "mozilla/dom/SpeechRecognitionEvent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -664,7 +664,7 @@ ReportExceptionIfPending(JSContext *cx)
|
||||
}
|
||||
|
||||
nsJSObjWrapper::nsJSObjWrapper(NPP npp)
|
||||
: mJSObj(nullptr), mNpp(npp)
|
||||
: mJSObj(nullptr), mNpp(npp), mDestroyPending(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsJSObjWrapper);
|
||||
OnWrapperCreated();
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "prprf.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIInputStreamTee.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsError.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
// See the architecture comment in this file's header.
|
||||
|
@ -36,7 +36,9 @@ struct TranslationParams { // Simple translation
|
||||
float mY;
|
||||
};
|
||||
struct PathPointParams { // Point along a path
|
||||
Path* mPath; // NOTE: Refcounted; need to AddRef/Release.
|
||||
// Refcounted: need to AddRef/Release. This can't be an nsRefPtr because
|
||||
// this struct is used inside a union so it can't have a default constructor.
|
||||
Path* MOZ_OWNING_REF mPath;
|
||||
float mDistToPoint; // Distance from path start to the point on the path that
|
||||
// we're interested in.
|
||||
};
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "SVGAnimatedPathSegList.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <stdarg.h>
|
||||
#include "nsSMILMappedAttribute.h"
|
||||
#include "SVGMotionSMILAttr.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "mozilla/dom/FetchEventBinding.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "RuntimeService.h"
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "prthread.h"
|
||||
#include "xpcpublic.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -23,6 +24,7 @@
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
@ -475,34 +477,17 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
|
||||
nsFocusManager::GetFocusedDescendant(windowToCheck, true, getter_AddRefs(focusedWindow));
|
||||
}
|
||||
|
||||
bool isLink = false;
|
||||
nsIContent *content = focusedContent;
|
||||
// If the focus is in an editable region, don't scroll.
|
||||
if (focusedContent->IsEditable()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// if the focused element is a link then we do want space to
|
||||
// scroll down. The focused element may be an element in a link,
|
||||
// we need to check the parent node too. Only do this check if an
|
||||
// element is focused and has a parent.
|
||||
if (focusedContent && focusedContent->GetParent()) {
|
||||
while (content) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::a)) {
|
||||
isLink = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
|
||||
isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters);
|
||||
|
||||
if (isLink) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
content = content->GetParent();
|
||||
}
|
||||
|
||||
if (!isLink)
|
||||
// If the focus is in a form control, don't scroll.
|
||||
for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
|
||||
if (formControl) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4434,13 +4434,11 @@ XULDocument::CachedChromeStreamListener::CachedChromeStreamListener(XULDocument*
|
||||
: mDocument(aDocument),
|
||||
mProtoLoaded(aProtoLoaded)
|
||||
{
|
||||
NS_ADDREF(mDocument);
|
||||
}
|
||||
|
||||
|
||||
XULDocument::CachedChromeStreamListener::~CachedChromeStreamListener()
|
||||
{
|
||||
NS_RELEASE(mDocument);
|
||||
}
|
||||
|
||||
|
||||
|
@ -684,8 +684,8 @@ protected:
|
||||
|
||||
class CachedChromeStreamListener : public nsIStreamListener {
|
||||
protected:
|
||||
XULDocument* mDocument;
|
||||
bool mProtoLoaded;
|
||||
nsRefPtr<XULDocument> mDocument;
|
||||
bool mProtoLoaded;
|
||||
|
||||
virtual ~CachedChromeStreamListener();
|
||||
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
// The XUL doc interface
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsError.h" // for NS_SUCCEEDED, NS_FAILED, etc
|
||||
#include "nsIPresShell.h" // nsISelectionController constants
|
||||
#include "nsRange.h" // local var
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsDebug.h" // for NS_ASSERTION, etc
|
||||
#include "nsEditor.h" // mEditor
|
||||
#include "nsError.h" // for NS_OK, etc
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "IMETextTxn.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "nsRange.h"
|
||||
#include "nsServiceManagerUtils.h" // for do_GetService
|
||||
#include "nsString.h" // for nsAutoString
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
|
||||
#include "nsContentUtils.h" // for nsContentUtils, etc
|
||||
#include "nsIBidiKeyboard.h" // for nsIBidiKeyboard
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsRange.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
13
editor/libeditor/tests/file_bug915962.html
Normal file
13
editor/libeditor/tests/file_bug915962.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<button>Button</button>
|
||||
<img src="green.png" usemap="#map">
|
||||
<map name="map">
|
||||
<!-- This URL ensures that the link doesn't get clicked, since
|
||||
mochitests cannot access the outside network. -->
|
||||
<area shape="rect" coords="0,0,10,10" href="https://youtube.com/">
|
||||
</map>
|
||||
<div style="height: 20000px;" tabindex="-1"><hr></div>
|
||||
</body>
|
||||
</html>
|
@ -9,6 +9,7 @@ support-files =
|
||||
file_bug549262.html
|
||||
file_bug586662.html
|
||||
file_bug674770-1.html
|
||||
file_bug915962.html
|
||||
file_select_all_without_body.html
|
||||
green.png
|
||||
spellcheck.js
|
||||
@ -137,6 +138,8 @@ skip-if = toolkit == 'android' || e10s
|
||||
[test_bug832025.html]
|
||||
[test_bug857487.html]
|
||||
[test_bug858918.html]
|
||||
[test_bug915962.html]
|
||||
skip-if = toolkit == 'android' || e10s
|
||||
[test_bug966155.html]
|
||||
skip-if = os != "win"
|
||||
[test_bug966552.html]
|
||||
|
85
editor/libeditor/tests/test_bug915962.html
Normal file
85
editor/libeditor/tests/test_bug915962.html
Normal file
@ -0,0 +1,85 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=915962
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 915962</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 915962 **/
|
||||
|
||||
var smoothScrollPref = "general.smoothScroll";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var win = window.open("file_bug915962.html", "_blank",
|
||||
"width=600,height=600,scrollbars=yes");
|
||||
|
||||
// grab the timer right at the start
|
||||
var cwu = SpecialPowers.getDOMWindowUtils(win);
|
||||
function step() {
|
||||
cwu.advanceTimeAndRefresh(100);
|
||||
}
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
|
||||
}, win);
|
||||
function startTest() {
|
||||
// Make sure that pressing Space when a tabindex=-1 element is focused
|
||||
// will scroll the page.
|
||||
var button = win.document.querySelector("button");
|
||||
var sc = win.document.querySelector("div");
|
||||
sc.focus();
|
||||
is(win.scrollY, 0, "Sanity check");
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
isnot(win.scrollY, 0, "Page is scrolled down");
|
||||
var oldY = win.scrollY;
|
||||
synthesizeKey(" ", {shiftKey: true}, win);
|
||||
|
||||
step();
|
||||
|
||||
ok(win.scrollY < oldY, "Page is scrolled up");
|
||||
|
||||
// Make sure that pressing Space when a tabindex=-1 element is focused
|
||||
// will not scroll the page, and will activate the element.
|
||||
button.focus();
|
||||
var clicked = false;
|
||||
button.onclick = () => clicked = true;
|
||||
oldY = win.scrollY;
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
ok(win.scrollY <= oldY, "Page is not scrolled down");
|
||||
ok(clicked, "The button should be clicked");
|
||||
synthesizeKey("VK_TAB", {}, win);
|
||||
|
||||
step();
|
||||
|
||||
oldY = win.scrollY;
|
||||
synthesizeKey(" ", {}, win);
|
||||
|
||||
step()
|
||||
|
||||
ok(win.scrollY >= oldY, "Page is scrolled down");
|
||||
|
||||
win.close();
|
||||
cwu.restoreNormalRefresh();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1222,6 +1222,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
{ (PRFuncPtr*) &mSymbols.fUniform3uiv, { "Uniform3uiv", "Uniform3uivEXT", nullptr } },
|
||||
{ (PRFuncPtr*) &mSymbols.fUniform4uiv, { "Uniform4uiv", "Uniform4uivEXT", nullptr } },
|
||||
{ (PRFuncPtr*) &mSymbols.fGetFragDataLocation, { "GetFragDataLocation", "GetFragDataLocationEXT", nullptr } },
|
||||
{ (PRFuncPtr*) &mSymbols.fGetUniformuiv, { "GetUniformuiv", "GetUniformuivEXT", nullptr } },
|
||||
END_SYMBOLS
|
||||
};
|
||||
|
||||
|
@ -1421,6 +1421,13 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetUniformuiv(GLuint program, GLint location, GLuint* params) {
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fGetUniformuiv);
|
||||
mSymbols.fGetUniformuiv(program, location, params);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
GLint fGetUniformLocation (GLint programObj, const GLchar* name) {
|
||||
BEFORE_GL_CALL;
|
||||
GLint retval = mSymbols.fGetUniformLocation(programObj, name);
|
||||
|
@ -165,6 +165,8 @@ struct GLContextSymbols
|
||||
PFNGLGETUNIFORMFVPROC fGetUniformfv;
|
||||
typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);
|
||||
PFNGLGETUNIFORMIVPROC fGetUniformiv;
|
||||
typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint* params);
|
||||
PFNGLGETUNIFORMUIVPROC fGetUniformuiv;
|
||||
typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLint programObj, const GLchar* name);
|
||||
PFNGLGETUNIFORMLOCATIONPROC fGetUniformLocation;
|
||||
typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);
|
||||
@ -657,19 +659,19 @@ struct GLContextSymbols
|
||||
GLint yoffset, GLint zoffset, GLint x,
|
||||
GLint y, GLsizei width, GLsizei height);
|
||||
PFNGLCOPYTEXSUBIMAGE3DPROC fCopyTexSubImage3D;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3D) (GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border, GLsizei imageSize, const GLvoid* data);
|
||||
PFNGLCOMPRESSEDTEXIMAGE3D fCompressedTexImage3D;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3D) (GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format, GLsizei imageSize, const GLvoid* data);
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE3D fCompressedTexSubImage3D;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border, GLsizei imageSize, const GLvoid* data);
|
||||
PFNGLCOMPRESSEDTEXIMAGE3DPROC fCompressedTexImage3D;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format, GLsizei imageSize, const GLvoid* data);
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC fCompressedTexSubImage3D;
|
||||
|
||||
// get_string_indexed
|
||||
typedef const GLubyte* (GLAPIENTRY * pfnGLGetStringiT)(GLenum name, GLuint index);
|
||||
pfnGLGetStringiT fGetStringi;
|
||||
typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC)(GLenum name, GLuint index);
|
||||
PFNGLGETSTRINGIPROC fGetStringi;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ APZCCallbackHelper::DispatchSynthesizedMouseEvent(uint32_t aMsg,
|
||||
}
|
||||
|
||||
bool
|
||||
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const nsString& aType,
|
||||
const CSSPoint& aPoint,
|
||||
int32_t aButton,
|
||||
@ -442,11 +442,12 @@ APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils
|
||||
bool aIgnoreRootScrollFrame,
|
||||
unsigned short aInputSourceArg)
|
||||
{
|
||||
NS_ENSURE_TRUE(aUtils, true);
|
||||
NS_ENSURE_TRUE(aPresShell, true);
|
||||
|
||||
bool defaultPrevented = false;
|
||||
aUtils->SendMouseEvent(aType, aPoint.x, aPoint.y, aButton, aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame, 0, aInputSourceArg, false, 4, &defaultPrevented);
|
||||
nsContentUtils::SendMouseEvent(aPresShell, aType, aPoint.x, aPoint.y,
|
||||
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, 0,
|
||||
aInputSourceArg, false, &defaultPrevented, false);
|
||||
return defaultPrevented;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
|
||||
/* Dispatch a mouse event with the given parameters.
|
||||
* Return whether or not any listeners have called preventDefault on the event. */
|
||||
static bool DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
static bool DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const nsString& aType,
|
||||
const CSSPoint& aPoint,
|
||||
int32_t aButton,
|
||||
|
@ -190,7 +190,7 @@ APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
|
||||
}
|
||||
|
||||
void
|
||||
APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
APZEventState::ProcessLongTap(const nsCOMPtr<nsIPresShell>& aPresShell,
|
||||
const CSSPoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
@ -211,7 +211,7 @@ APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
// just converts them back to widget format, but that API has many callers,
|
||||
// including in JS code, so it's not trivial to change.
|
||||
bool eventHandled =
|
||||
APZCCallbackHelper::DispatchMouseEvent(aUtils, NS_LITERAL_STRING("contextmenu"),
|
||||
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
|
||||
APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid, aPresShellResolution),
|
||||
2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "nsRefPtr.h"
|
||||
|
||||
template <class> class nsCOMPtr;
|
||||
class nsIDOMWindowUtils;
|
||||
class nsIPresShell;
|
||||
class nsIWidget;
|
||||
|
||||
namespace mozilla {
|
||||
@ -53,7 +53,7 @@ public:
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
float aPresShellResolution);
|
||||
void ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
|
||||
void ProcessLongTap(const nsCOMPtr<nsIPresShell>& aUtils,
|
||||
const CSSPoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
@ -179,7 +179,7 @@ ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, Modifier
|
||||
return;
|
||||
}
|
||||
|
||||
mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aModifiers, aGuid,
|
||||
mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, GetPresShellResolution());
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,9 @@ TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aText
|
||||
//MOZ_ASSERT(mFormat != gfx::FORMAT_YUV, "This TextureClient cannot use YCbCr data");
|
||||
|
||||
MOZ_ASSERT(aSize.width >= 0 && aSize.height >= 0);
|
||||
if (aSize.width <= 0 || aSize.height <= 0) {
|
||||
if (aSize.width <= 0 || aSize.height <= 0 ||
|
||||
aSize.width > XLIB_IMAGE_SIDE_SIZE_LIMIT ||
|
||||
aSize.height > XLIB_IMAGE_SIDE_SIZE_LIMIT) {
|
||||
gfxDebug() << "Asking for X11 surface of invalid size " << aSize.width << "x" << aSize.height;
|
||||
return false;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
|
||||
#endif
|
||||
|
||||
virtual bool SupportsApzTouchInput() override {
|
||||
virtual bool SupportsApzTouchInput() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -622,10 +622,10 @@ public:
|
||||
/**
|
||||
* Used to test which input types are handled via APZ.
|
||||
*/
|
||||
virtual bool SupportsApzWheelInput() {
|
||||
virtual bool SupportsApzWheelInput() const {
|
||||
return false;
|
||||
}
|
||||
virtual bool SupportsApzTouchInput() {
|
||||
virtual bool SupportsApzTouchInput() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
|
||||
virtual int GetScreenDepth() const override;
|
||||
|
||||
bool SupportsApzWheelInput() override {
|
||||
bool SupportsApzWheelInput() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool SupportsApzWheelInput() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UseAcceleratedCanvas();
|
||||
|
||||
virtual bool UseProgressivePaint() override;
|
||||
|
@ -389,7 +389,7 @@ IsSafeImageTransformComponent(gfxFloat aValue)
|
||||
return aValue >= -32768 && aValue <= 32767;
|
||||
}
|
||||
|
||||
#ifndef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
#if !defined(MOZ_GFX_OPTIMIZE_MOBILE) && !defined(MOZ_WIDGET_COCOA)
|
||||
/**
|
||||
* This returns the fastest operator to use for solid surfaces which have no
|
||||
* alpha channel or their alpha channel is uniformly opaque.
|
||||
@ -455,7 +455,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
|
||||
nsRefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft()));
|
||||
return drawable.forget();
|
||||
}
|
||||
#endif // !MOZ_GFX_OPTIMIZE_MOBILE
|
||||
#endif // !MOZ_GFX_OPTIMIZE_MOBILE && !MOZ_WIDGET_COCOA
|
||||
|
||||
// working around cairo/pixman bug (bug 364968)
|
||||
// Our device-space-to-image-space transform may not be acceptable to pixman.
|
||||
@ -650,7 +650,7 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
|
||||
// On Mobile, we don't ever want to do this; it has the potential for
|
||||
// allocating very large temporary surfaces, especially since we'll
|
||||
// do full-page snapshots often (see bug 749426).
|
||||
#ifndef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
#if !defined(MOZ_GFX_OPTIMIZE_MOBILE) && !defined(MOZ_WIDGET_COCOA)
|
||||
nsRefPtr<gfxDrawable> restrictedDrawable =
|
||||
CreateSamplingRestrictedDrawable(aDrawable, aContext,
|
||||
aRegion, aFormat);
|
||||
|
@ -2277,7 +2277,7 @@ gfxWindowsPlatform::CreateHardwareVsyncSource()
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::SupportsApzTouchInput()
|
||||
gfxWindowsPlatform::SupportsApzTouchInput() const
|
||||
{
|
||||
int value = Preferences::GetInt("dom.w3c_touch_events.enabled", 0);
|
||||
return value == 1 || value == 2;
|
||||
|
@ -257,10 +257,10 @@ public:
|
||||
|
||||
bool IsWARP() { return mIsWARP; }
|
||||
|
||||
bool SupportsApzWheelInput() override {
|
||||
bool SupportsApzWheelInput() const override {
|
||||
return true;
|
||||
}
|
||||
bool SupportsApzTouchInput() override;
|
||||
bool SupportsApzTouchInput() const override;
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
||||
static mozilla::Atomic<size_t> sD3D11MemoryUsed;
|
||||
|
@ -21,11 +21,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// Although the dimension parameters in the xCreatePixmapReq wire protocol are
|
||||
// 16-bit unsigned integers, the server's CreatePixmap returns BadAlloc if
|
||||
// either dimension cannot be represented by a 16-bit *signed* integer.
|
||||
#define XLIB_IMAGE_SIDE_SIZE_LIMIT 0x7fff
|
||||
|
||||
gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
|
||||
: mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
|
||||
#if defined(GL_PROVIDER_GLX)
|
||||
|
@ -17,6 +17,12 @@
|
||||
|
||||
#include "nsSize.h"
|
||||
|
||||
// Although the dimension parameters in the xCreatePixmapReq wire protocol are
|
||||
// 16-bit unsigned integers, the server's CreatePixmap returns BadAlloc if
|
||||
// either dimension cannot be represented by a 16-bit *signed* integer.
|
||||
#define XLIB_IMAGE_SIDE_SIZE_LIMIT 0x7fff
|
||||
|
||||
|
||||
class gfxXlibSurface final : public gfxASurface {
|
||||
public:
|
||||
// construct a wrapper around the specified drawable with dpy/visual.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "ImageLogging.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
|
||||
#include "imgLoader.h"
|
||||
#include "Image.h"
|
||||
#include "ImageOps.h"
|
||||
#include "nsError.h"
|
||||
@ -695,6 +695,11 @@ imgRequestProxy::PerformClone(imgINotificationObserver* aObserver,
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (GetOwner() && GetOwner()->GetValidator()) {
|
||||
clone->SetNotificationsDeferred(true);
|
||||
GetOwner()->GetValidator()->AddProxy(clone);
|
||||
}
|
||||
|
||||
// Assign to *aClone before calling Notify so that if the caller expects to
|
||||
// only be notified for requests it's already holding pointers to it won't be
|
||||
// surprised.
|
||||
|
@ -7399,8 +7399,8 @@ CheckHeapLengthCondition(ModuleCompiler& m, ParseNode* cond, PropertyName* newBu
|
||||
uint32_t minLengthExclusive;
|
||||
if (!IsLiteralInt(m, minLengthNode, &minLengthExclusive))
|
||||
return m.fail(minLengthNode, "expecting integer literal");
|
||||
if (minLengthExclusive < 0xffffff)
|
||||
return m.fail(minLengthNode, "literal must be >= 0xffffff");
|
||||
if (minLengthExclusive < 0xffffff || minLengthExclusive == UINT32_MAX)
|
||||
return m.fail(minLengthNode, "literal must be >= 0xffffff and < 0xffffffff");
|
||||
|
||||
// Add one to convert from exclusive (the branch rejects if ==) to inclusive.
|
||||
*minLength = minLengthExclusive + 1;
|
||||
|
@ -53,7 +53,7 @@ function ArrayIndexOf(searchElement/*, fromIndex*/) {
|
||||
|
||||
function ArrayStaticIndexOf(list, searchElement/*, fromIndex*/) {
|
||||
if (arguments.length < 1)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.indexOf');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.indexOf');
|
||||
var fromIndex = arguments.length > 2 ? arguments[2] : 0;
|
||||
return callFunction(ArrayIndexOf, list, searchElement, fromIndex);
|
||||
}
|
||||
@ -101,7 +101,7 @@ function ArrayLastIndexOf(searchElement/*, fromIndex*/) {
|
||||
|
||||
function ArrayStaticLastIndexOf(list, searchElement/*, fromIndex*/) {
|
||||
if (arguments.length < 1)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.lastIndexOf');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.lastIndexOf');
|
||||
var fromIndex;
|
||||
if (arguments.length > 2) {
|
||||
fromIndex = arguments[2];
|
||||
@ -147,9 +147,9 @@ function ArrayEvery(callbackfn/*, thisArg*/) {
|
||||
|
||||
function ArrayStaticEvery(list, callbackfn/*, thisArg*/) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.every');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.every');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
var T = arguments.length > 2 ? arguments[2] : void 0;
|
||||
return callFunction(ArrayEvery, list, callbackfn, T);
|
||||
}
|
||||
@ -164,9 +164,9 @@ function ArraySome(callbackfn/*, thisArg*/) {
|
||||
|
||||
/* Step 4. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.some');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.some');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
|
||||
/* Step 5. */
|
||||
var T = arguments.length > 1 ? arguments[1] : void 0;
|
||||
@ -188,9 +188,9 @@ function ArraySome(callbackfn/*, thisArg*/) {
|
||||
|
||||
function ArrayStaticSome(list, callbackfn/*, thisArg*/) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.some');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.some');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
var T = arguments.length > 2 ? arguments[2] : void 0;
|
||||
return callFunction(ArraySome, list, callbackfn, T);
|
||||
}
|
||||
@ -205,9 +205,9 @@ function ArrayForEach(callbackfn/*, thisArg*/) {
|
||||
|
||||
/* Step 4. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.forEach');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.forEach');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
|
||||
/* Step 5. */
|
||||
var T = arguments.length > 1 ? arguments[1] : void 0;
|
||||
@ -236,9 +236,9 @@ function ArrayMap(callbackfn/*, thisArg*/) {
|
||||
|
||||
/* Step 4. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.map');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.map');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
|
||||
/* Step 5. */
|
||||
var T = arguments.length > 1 ? arguments[1] : void 0;
|
||||
@ -264,18 +264,18 @@ function ArrayMap(callbackfn/*, thisArg*/) {
|
||||
|
||||
function ArrayStaticMap(list, callbackfn/*, thisArg*/) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.map');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.map');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
var T = arguments.length > 2 ? arguments[2] : void 0;
|
||||
return callFunction(ArrayMap, list, callbackfn, T);
|
||||
}
|
||||
|
||||
function ArrayStaticForEach(list, callbackfn/*, thisArg*/) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.forEach');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.forEach');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
var T = arguments.length > 2 ? arguments[2] : void 0;
|
||||
callFunction(ArrayForEach, list, callbackfn, T);
|
||||
}
|
||||
@ -290,9 +290,9 @@ function ArrayReduce(callbackfn/*, initialValue*/) {
|
||||
|
||||
/* Step 4. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.reduce');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.reduce');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
|
||||
/* Step 6. */
|
||||
var k = 0;
|
||||
@ -304,7 +304,7 @@ function ArrayReduce(callbackfn/*, initialValue*/) {
|
||||
} else {
|
||||
/* Step 5. */
|
||||
if (len === 0)
|
||||
ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
if (IsPackedArray(O)) {
|
||||
accumulator = O[k++];
|
||||
} else {
|
||||
@ -318,7 +318,7 @@ function ArrayReduce(callbackfn/*, initialValue*/) {
|
||||
}
|
||||
}
|
||||
if (!kPresent)
|
||||
ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,9 +338,9 @@ function ArrayReduce(callbackfn/*, initialValue*/) {
|
||||
|
||||
function ArrayStaticReduce(list, callbackfn) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.reduce');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.reduce');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
if (arguments.length > 2)
|
||||
return callFunction(ArrayReduce, list, callbackfn, arguments[2]);
|
||||
else
|
||||
@ -357,9 +357,9 @@ function ArrayReduceRight(callbackfn/*, initialValue*/) {
|
||||
|
||||
/* Step 4. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.reduce');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.reduce');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
|
||||
|
||||
/* Step 6. */
|
||||
var k = len - 1;
|
||||
@ -371,7 +371,7 @@ function ArrayReduceRight(callbackfn/*, initialValue*/) {
|
||||
} else {
|
||||
/* Step 5. */
|
||||
if (len === 0)
|
||||
ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
if (IsPackedArray(O)) {
|
||||
accumulator = O[k--];
|
||||
} else {
|
||||
@ -385,7 +385,7 @@ function ArrayReduceRight(callbackfn/*, initialValue*/) {
|
||||
}
|
||||
}
|
||||
if (!kPresent)
|
||||
ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,9 +405,9 @@ function ArrayReduceRight(callbackfn/*, initialValue*/) {
|
||||
|
||||
function ArrayStaticReduceRight(list, callbackfn) {
|
||||
if (arguments.length < 2)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.reduceRight');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.reduceRight');
|
||||
if (!IsCallable(callbackfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, callbackfn));
|
||||
if (arguments.length > 2)
|
||||
return callFunction(ArrayReduceRight, list, callbackfn, arguments[2]);
|
||||
else
|
||||
@ -424,9 +424,9 @@ function ArrayFind(predicate/*, thisArg*/) {
|
||||
|
||||
/* Step 6. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.find');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.find');
|
||||
if (!IsCallable(predicate))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
|
||||
|
||||
/* Step 7. */
|
||||
var T = arguments.length > 1 ? arguments[1] : undefined;
|
||||
@ -460,9 +460,9 @@ function ArrayFindIndex(predicate/*, thisArg*/) {
|
||||
|
||||
/* Step 6. */
|
||||
if (arguments.length === 0)
|
||||
ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.find');
|
||||
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'Array.prototype.find');
|
||||
if (!IsCallable(predicate))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
|
||||
|
||||
/* Step 7. */
|
||||
var T = arguments.length > 1 ? arguments[1] : undefined;
|
||||
@ -715,7 +715,7 @@ function ArrayFrom(items, mapfn=undefined, thisArg=undefined) {
|
||||
// Steps 2-3.
|
||||
var mapping = mapfn !== undefined;
|
||||
if (mapping && !IsCallable(mapfn))
|
||||
ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, mapfn));
|
||||
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, mapfn));
|
||||
var T = thisArg;
|
||||
|
||||
// All elements defined by this algorithm have the same attrs:
|
||||
@ -742,7 +742,7 @@ function ArrayFrom(items, mapfn=undefined, thisArg=undefined) {
|
||||
// Steps 6.g.i-iii.
|
||||
var next = iterator.next();
|
||||
if (!IsObject(next))
|
||||
ThrowError(JSMSG_NEXT_RETURNED_PRIMITIVE);
|
||||
ThrowTypeError(JSMSG_NEXT_RETURNED_PRIMITIVE);
|
||||
|
||||
// Step 6.g.iv.
|
||||
if (next.done) {
|
||||
|
@ -8,7 +8,7 @@ function ErrorToString()
|
||||
/* Steps 1-2. */
|
||||
var obj = this;
|
||||
if (!IsObject(obj))
|
||||
ThrowError(JSMSG_INCOMPATIBLE_PROTO, "Error", "toString", "value");
|
||||
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "Error", "toString", "value");
|
||||
|
||||
/* Steps 3-5. */
|
||||
var name = obj.name;
|
||||
|
@ -15,7 +15,7 @@ function StarGeneratorNext(val) {
|
||||
return { value: undefined, done: true };
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -36,7 +36,7 @@ function StarGeneratorThrow(val) {
|
||||
throw val;
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -57,7 +57,7 @@ function StarGeneratorReturn(val) {
|
||||
return { value: val, done: true };
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -78,7 +78,7 @@ function LegacyGeneratorNext(val) {
|
||||
ThrowStopIteration();
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
|
||||
try {
|
||||
return resumeGenerator(this, val, 'next');
|
||||
@ -97,7 +97,7 @@ function LegacyGeneratorThrow(val) {
|
||||
throw val;
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
|
||||
try {
|
||||
return resumeGenerator(this, val, 'throw');
|
||||
@ -115,7 +115,7 @@ function LegacyGeneratorCloseInternal() {
|
||||
assert(!LegacyGeneratorObjectIsClosed(this), "Already closed: " + ToString(this));
|
||||
|
||||
if (GeneratorIsRunning(this))
|
||||
ThrowError(JSMSG_NESTING_GENERATOR);
|
||||
ThrowTypeError(JSMSG_NESTING_GENERATOR);
|
||||
|
||||
resumeGenerator(this, undefined, 'close');
|
||||
if (!LegacyGeneratorObjectIsClosed(this))
|
||||
|
@ -843,7 +843,7 @@ function SupportedLocales(availableLocales, requestedLocales, options) {
|
||||
if (matcher !== undefined) {
|
||||
matcher = ToString(matcher);
|
||||
if (matcher !== "lookup" && matcher !== "best fit")
|
||||
ThrowError(JSMSG_INVALID_LOCALE_MATCHER, matcher);
|
||||
ThrowRangeError(JSMSG_INVALID_LOCALE_MATCHER, matcher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -888,7 +888,7 @@ function GetOption(options, property, type, values, fallback) {
|
||||
|
||||
// Step 2.d.
|
||||
if (values !== undefined && callFunction(std_Array_indexOf, values, value) === -1)
|
||||
ThrowError(JSMSG_INVALID_OPTION_VALUE, property, value);
|
||||
ThrowRangeError(JSMSG_INVALID_OPTION_VALUE, property, value);
|
||||
|
||||
// Step 2.e.
|
||||
return value;
|
||||
@ -917,7 +917,7 @@ function GetNumberOption(options, property, minimum, maximum, fallback) {
|
||||
if (value !== undefined) {
|
||||
value = ToNumber(value);
|
||||
if (Number_isNaN(value) || value < minimum || value > maximum)
|
||||
ThrowError(JSMSG_INVALID_DIGITS_VALUE, value);
|
||||
ThrowRangeError(JSMSG_INVALID_DIGITS_VALUE, value);
|
||||
return std_Math_floor(value);
|
||||
}
|
||||
|
||||
@ -1081,7 +1081,7 @@ function getIntlObjectInternals(obj, className, methodName) {
|
||||
assert(internals === undefined || isInitializedIntlObject(obj), "bad mapping in internalsMap");
|
||||
|
||||
if (internals === undefined || internals.type !== className)
|
||||
ThrowError(JSMSG_INTL_OBJECT_NOT_INITED, className, methodName, className);
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, className, methodName, className);
|
||||
|
||||
return internals;
|
||||
}
|
||||
@ -1255,7 +1255,7 @@ function InitializeCollator(collator, locales, options) {
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(collator))
|
||||
ThrowError(JSMSG_INTL_OBJECT_REINITED);
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(collator);
|
||||
@ -1597,7 +1597,7 @@ function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(numberFormat))
|
||||
ThrowError(JSMSG_INTL_OBJECT_REINITED);
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(numberFormat);
|
||||
@ -1666,11 +1666,11 @@ function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
// Steps 17-20.
|
||||
var c = GetOption(options, "currency", "string", undefined, undefined);
|
||||
if (c !== undefined && !IsWellFormedCurrencyCode(c))
|
||||
ThrowError(JSMSG_INVALID_CURRENCY_CODE, c);
|
||||
ThrowRangeError(JSMSG_INVALID_CURRENCY_CODE, c);
|
||||
var cDigits;
|
||||
if (s === "currency") {
|
||||
if (c === undefined)
|
||||
ThrowError(JSMSG_UNDEFINED_CURRENCY);
|
||||
ThrowTypeError(JSMSG_UNDEFINED_CURRENCY);
|
||||
|
||||
// Steps 20.a-c.
|
||||
c = toASCIIUpperCase(c);
|
||||
@ -2045,7 +2045,7 @@ function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(dateTimeFormat))
|
||||
ThrowError(JSMSG_INTL_OBJECT_REINITED);
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(dateTimeFormat);
|
||||
@ -2101,7 +2101,7 @@ function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
|
||||
if (tz !== undefined) {
|
||||
tz = toASCIIUpperCase(ToString(tz));
|
||||
if (tz !== "UTC")
|
||||
ThrowError(JSMSG_INVALID_TIME_ZONE, tz);
|
||||
ThrowRangeError(JSMSG_INVALID_TIME_ZONE, tz);
|
||||
}
|
||||
lazyDateTimeFormatData.timeZone = tz;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user