зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team.
This commit is contained in:
Коммит
94badf2c3a
2
CLOBBER
2
CLOBBER
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
Bug 848530 - Added a dependency file for moz.build traversal.
|
||||
Landing bug 865806
|
||||
|
||||
Alternative to clobber is to run ./config.status from the objdir and to
|
||||
touch the CLOBBER file in the objdir.
|
||||
|
|
|
@ -77,11 +77,7 @@ backend.RecursiveMakeBackend.built:
|
|||
@echo "Updating build backend because of moz.build changes."
|
||||
@$(PYTHON) ./config.status
|
||||
|
||||
ifdef .PYMAKE
|
||||
includedeps backend.RecursiveMakeBackend.built.pp
|
||||
else
|
||||
include backend.RecursiveMakeBackend.built.pp
|
||||
endif
|
||||
|
||||
export MOZBUILD_BACKEND_CHECKED=1
|
||||
|
||||
|
|
|
@ -26,18 +26,22 @@ SRCS_IN_OBJDIR = 1
|
|||
# Makefile is ported over.
|
||||
MIDL_INTERFACES = \
|
||||
Accessible2.idl \
|
||||
Accessible2_2.idl \
|
||||
AccessibleAction.idl \
|
||||
AccessibleApplication.idl \
|
||||
AccessibleComponent.idl \
|
||||
AccessibleDocument.idl \
|
||||
AccessibleEditableText.idl \
|
||||
AccessibleHyperlink.idl \
|
||||
AccessibleHypertext.idl \
|
||||
AccessibleHypertext2.idl \
|
||||
AccessibleImage.idl \
|
||||
AccessibleRelation.idl \
|
||||
AccessibleTable.idl \
|
||||
AccessibleTable2.idl \
|
||||
AccessibleTableCell.idl \
|
||||
AccessibleText.idl \
|
||||
AccessibleText2.idl \
|
||||
AccessibleValue.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -10,18 +10,22 @@ MODULE = 'accessibility'
|
|||
# is ported over.
|
||||
midl_interfaces = [
|
||||
'Accessible2',
|
||||
'Accessible2_2',
|
||||
'AccessibleAction',
|
||||
'AccessibleApplication',
|
||||
'AccessibleComponent',
|
||||
'AccessibleDocument',
|
||||
'AccessibleEditableText',
|
||||
'AccessibleHyperlink',
|
||||
'AccessibleHypertext',
|
||||
'AccessibleHypertext2',
|
||||
'AccessibleImage',
|
||||
'AccessibleRelation',
|
||||
'AccessibleTable',
|
||||
'AccessibleTable2',
|
||||
'AccessibleTableCell',
|
||||
'AccessibleText',
|
||||
'AccessibleText2',
|
||||
'AccessibleValue',
|
||||
]
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ XPIDL_SOURCES += [
|
|||
'nsIAccessible.idl',
|
||||
'nsIAccessibleApplication.idl',
|
||||
'nsIAccessibleCaretMoveEvent.idl',
|
||||
'nsIAccessibleCursorable.idl',
|
||||
'nsIAccessibleDocument.idl',
|
||||
'nsIAccessibleEditableText.idl',
|
||||
'nsIAccessibleEvent.idl',
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAccessiblePivot;
|
||||
|
||||
/**
|
||||
* An interface implemented by an accessible object that has an associated
|
||||
* virtual cursor. Typically, a top-level application or content document.
|
||||
* A virtual cursor is an implementation of nsIAccessiblePivot that provides an
|
||||
* exclusive spot in the cursorable's subtree, this could be used to create a
|
||||
* pseudo-focus or caret browsing experience that is centered around the
|
||||
* accessibility API.
|
||||
*/
|
||||
[scriptable, uuid(5452dea5-d235-496f-8757-3ca016ff49ff)]
|
||||
interface nsIAccessibleCursorable : nsISupports
|
||||
{
|
||||
/**
|
||||
* The virtual cursor pivot this object manages.
|
||||
*/
|
||||
readonly attribute nsIAccessiblePivot virtualCursor;
|
||||
};
|
|
@ -6,6 +6,7 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAccessible;
|
||||
interface nsIAccessiblePivot;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMWindow;
|
||||
|
@ -21,7 +22,7 @@ interface nsIDOMWindow;
|
|||
* nsIAccessible::GetAccessibleDocument() or
|
||||
* nsIAccessibleEvent::GetAccessibleDocument()
|
||||
*/
|
||||
[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]
|
||||
[scriptable, uuid(fe5b3886-2b6a-491a-80cd-a3e6342c451d)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -75,6 +76,11 @@ interface nsIAccessibleDocument : nsISupports
|
|||
*/
|
||||
readonly attribute unsigned long childDocumentCount;
|
||||
|
||||
/**
|
||||
* The virtual cursor pivot this document manages.
|
||||
*/
|
||||
readonly attribute nsIAccessiblePivot virtualCursor;
|
||||
|
||||
/**
|
||||
* Return the child document accessible at the given index.
|
||||
*/
|
||||
|
|
|
@ -130,8 +130,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DocAccessible)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivotObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleCursorable,
|
||||
(mDocFlags & eCursorable))
|
||||
foundInterface = 0;
|
||||
|
||||
nsresult status;
|
||||
|
@ -477,7 +475,6 @@ DocAccessible::GetChildDocumentAt(uint32_t aIndex,
|
|||
return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// nsIAccessibleVirtualCursor method
|
||||
NS_IMETHODIMP
|
||||
DocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
|
||||
{
|
||||
|
@ -487,9 +484,6 @@ DocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!(mDocFlags & eCursorable))
|
||||
return NS_OK;
|
||||
|
||||
if (!mVirtualCursor) {
|
||||
mVirtualCursor = new nsAccessiblePivot(this);
|
||||
mVirtualCursor->AddObserver(this);
|
||||
|
@ -1465,10 +1459,6 @@ DocAccessible::DoInitialUpdate()
|
|||
if (nsCoreUtils::IsTabDocument(mDocumentNode))
|
||||
mDocFlags |= eTabDocument;
|
||||
|
||||
// We provide a virtual cursor if this is a root doc or if it's a tab doc.
|
||||
if (!mDocumentNode->GetParentDocument() || (mDocFlags & eTabDocument))
|
||||
mDocFlags |= eCursorable;
|
||||
|
||||
mLoadState |= eTreeConstructed;
|
||||
|
||||
// The content element may be changed before the initial update and then we
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef mozilla_a11y_DocAccessible_h__
|
||||
#define mozilla_a11y_DocAccessible_h__
|
||||
|
||||
#include "nsIAccessibleCursorable.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessiblePivot.h"
|
||||
|
||||
|
@ -45,7 +44,6 @@ class DocAccessible : public HyperTextAccessibleWrap,
|
|||
public nsIObserver,
|
||||
public nsIScrollPositionListener,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIAccessibleCursorable,
|
||||
public nsIAccessiblePivotObserver
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -55,8 +53,6 @@ class DocAccessible : public HyperTextAccessibleWrap,
|
|||
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
NS_DECL_NSIACCESSIBLECURSORABLE
|
||||
|
||||
NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
|
||||
|
||||
public:
|
||||
|
@ -492,11 +488,8 @@ protected:
|
|||
// Whether scroll listeners were added.
|
||||
eScrollInitialized = 1 << 0,
|
||||
|
||||
// Whether we support nsIAccessibleCursorable.
|
||||
eCursorable = 1 << 1,
|
||||
|
||||
// Whether the document is a tab document.
|
||||
eTabDocument = 1 << 2
|
||||
eTabDocument = 1 << 1
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -539,7 +532,7 @@ protected:
|
|||
nsTArray<nsRefPtr<DocAccessible> > mChildDocuments;
|
||||
|
||||
/**
|
||||
* The virtual cursor of the document when it supports nsIAccessibleCursorable.
|
||||
* The virtual cursor of the document.
|
||||
*/
|
||||
nsRefPtr<nsAccessiblePivot> mVirtualCursor;
|
||||
|
||||
|
|
|
@ -26,27 +26,17 @@
|
|||
|
||||
function doTest()
|
||||
{
|
||||
var rootAcc = getRootAccessible(browserWindow().document);
|
||||
try {
|
||||
rootAcc.QueryInterface(nsIAccessibleCursorable);
|
||||
} catch (e) {
|
||||
ok(false, "Root accessible does not support nsIAccessibleCursorable");
|
||||
}
|
||||
var rootAcc = getAccessible(browserDocument(), [nsIAccessibleDocument]);
|
||||
ok(rootAcc.virtualCursor,
|
||||
"root document does not have virtualCursor");
|
||||
|
||||
var doc = currentTabDocument();
|
||||
var docAcc = getAccessible(doc, [nsIAccessibleDocument,
|
||||
nsIAccessibleCursorable]);
|
||||
var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
|
||||
|
||||
// Test that embedded documents don't have their own virtual cursor.
|
||||
// Test that embedded documents have their own virtual cursor.
|
||||
is(docAcc.childDocumentCount, 1, "Expecting one child document");
|
||||
var childDoc = docAcc.getChildDocumentAt(0);
|
||||
var supportsVC = true;
|
||||
try {
|
||||
childDoc.QueryInterface(nsIAccessibleCursorable);
|
||||
} catch (e) {
|
||||
supportsVC = false;
|
||||
}
|
||||
|
||||
ok(!supportsVC, "no nsIAccessibleCursorable support in child document");
|
||||
ok(docAcc.getChildDocumentAt(0).virtualCursor,
|
||||
"child document does not have virtualCursor");
|
||||
|
||||
gQueue = new eventQueue();
|
||||
|
||||
|
|
|
@ -383,10 +383,11 @@ private:
|
|||
|
||||
// Returns null if a principal cannot be found; generally callers
|
||||
// should error out at that point.
|
||||
static nsIPrincipal* doGetObjectPrincipal(JSObject *obj);
|
||||
static nsIPrincipal* doGetObjectPrincipal(JS::Handle<JSObject*> obj);
|
||||
#ifdef DEBUG
|
||||
static nsIPrincipal*
|
||||
old_doGetObjectPrincipal(JSObject *obj, bool aAllowShortCircuit = true);
|
||||
old_doGetObjectPrincipal(JS::Handle<JSObject*> obj,
|
||||
bool aAllowShortCircuit = true);
|
||||
#endif
|
||||
|
||||
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
||||
|
|
|
@ -1633,7 +1633,7 @@ nsScriptSecurityManager::CheckFunctionAccess(JSContext *aCx, void *aFunObj,
|
|||
/*
|
||||
** Get origin of subject and object and compare.
|
||||
*/
|
||||
JSObject* obj = (JSObject*)aTargetObj;
|
||||
JS::Rooted<JSObject*> obj(aCx, (JSObject*)aTargetObj);
|
||||
nsIPrincipal* object = doGetObjectPrincipal(obj);
|
||||
|
||||
if (!object)
|
||||
|
@ -2023,7 +2023,8 @@ NS_IMETHODIMP
|
|||
nsScriptSecurityManager::GetObjectPrincipal(JSContext *aCx, JSObject *aObj,
|
||||
nsIPrincipal **result)
|
||||
{
|
||||
*result = doGetObjectPrincipal(aObj);
|
||||
JS::Rooted<JSObject*> obj(aCx, aObj);
|
||||
*result = doGetObjectPrincipal(obj);
|
||||
if (!*result)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*result);
|
||||
|
@ -2032,7 +2033,7 @@ nsScriptSecurityManager::GetObjectPrincipal(JSContext *aCx, JSObject *aObj,
|
|||
|
||||
// static
|
||||
nsIPrincipal*
|
||||
nsScriptSecurityManager::doGetObjectPrincipal(JSObject *aObj)
|
||||
nsScriptSecurityManager::doGetObjectPrincipal(JS::Handle<JSObject*> aObj)
|
||||
{
|
||||
JSCompartment *compartment = js::GetObjectCompartment(aObj);
|
||||
JSPrincipals *principals = JS_GetCompartmentPrincipals(compartment);
|
||||
|
@ -2052,14 +2053,15 @@ nsScriptSecurityManager::doGetObjectPrincipal(JSObject *aObj)
|
|||
#ifdef DEBUG
|
||||
// static
|
||||
nsIPrincipal*
|
||||
nsScriptSecurityManager::old_doGetObjectPrincipal(JSObject *aObj,
|
||||
nsScriptSecurityManager::old_doGetObjectPrincipal(JS::Handle<JSObject*> aObj,
|
||||
bool aAllowShortCircuit)
|
||||
{
|
||||
NS_ASSERTION(aObj, "Bad call to doGetObjectPrincipal()!");
|
||||
nsIPrincipal* result = nullptr;
|
||||
|
||||
JS::RootedObject obj(sXPConnect->GetCurrentJSContext(), aObj);
|
||||
JSObject* origObj = obj;
|
||||
JSContext* cx = sXPConnect->GetCurrentJSContext();
|
||||
JS::RootedObject obj(cx, aObj);
|
||||
JS::RootedObject origObj(cx, obj);
|
||||
js::Class *jsClass = js::GetObjectClass(obj);
|
||||
|
||||
// A common case seen in this code is that we enter this function
|
||||
|
@ -2292,8 +2294,8 @@ nsScriptSecurityManager::CheckXPCPermissions(JSContext* cx,
|
|||
do_QueryInterface(aObj);
|
||||
if (xpcwrappedjs)
|
||||
{
|
||||
rv = xpcwrappedjs->GetJSObject(jsObject.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
jsObject = xpcwrappedjs->GetJSObject();
|
||||
NS_ENSURE_STATE(jsObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ new
|
|||
# unsafely in Gecko, so we might as well prevent them from
|
||||
# throwing exceptions
|
||||
algorithm
|
||||
atomic
|
||||
deque
|
||||
iostream
|
||||
iterator
|
||||
|
@ -38,3 +39,4 @@ cstdlib
|
|||
cstring
|
||||
cwchar
|
||||
tuple
|
||||
xutility
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
/* 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 "domstubs.idl"
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
%{C++
|
||||
#ifdef GetBinaryType
|
||||
// Windows apparently has a #define for GetBinaryType...
|
||||
#undef GetBinaryType
|
||||
#endif
|
||||
%}
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, builtinclass, uuid(1aed816d-1156-414e-8fe2-f01daa6021f0)]
|
||||
[scriptable, builtinclass, uuid(4410f28d-c9eb-481d-a47e-e7ef49f382c8)]
|
||||
interface nsIDOMDataChannel : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute DOMString label;
|
||||
|
@ -25,14 +36,4 @@ interface nsIDOMDataChannel : nsIDOMEventTarget
|
|||
attribute DOMString binaryType;
|
||||
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Transmits data to other end of the connection.
|
||||
* @param data The data to be transmitted. Arraybuffers and Blobs are sent as
|
||||
* binary data. Strings are sent as UTF-8 text data. Other types are
|
||||
* converted to a String and sent as a String.
|
||||
* @return if the connection is still established and the data was queued or
|
||||
* sent successfully.
|
||||
*/
|
||||
void send(in nsIVariant data);
|
||||
};
|
||||
|
|
|
@ -35,7 +35,10 @@ EXPORTS += [
|
|||
]
|
||||
|
||||
if CONFIG['MOZ_WEBRTC']:
|
||||
EXPORTS += ['nsDOMDataChannel.h']
|
||||
EXPORTS += [
|
||||
'nsDOMDataChannel.h',
|
||||
'nsDOMDataChannelDeclarations.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Attr.h',
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* 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 "nsDOMDataChannel.h"
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
#define FORCE_PR_LOG
|
||||
#endif
|
||||
|
@ -18,101 +20,40 @@ extern PRLogModuleInfo* GetDataChannelLog();
|
|||
#define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)
|
||||
|
||||
|
||||
#include "nsDOMDataChannel.h"
|
||||
#include "nsDOMDataChannelDeclarations.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsIDOMDataChannel.h"
|
||||
#include "nsIDOMMessageEvent.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
||||
#include "js/Value.h"
|
||||
|
||||
#include "nsError.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
#include "DataChannel.h"
|
||||
|
||||
#ifdef GetBinaryType
|
||||
// Windows apparently has a #define for GetBinaryType...
|
||||
#undef GetBinaryType
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsDOMDataChannel : public nsDOMEventTargetHelper,
|
||||
public nsIDOMDataChannel,
|
||||
public mozilla::DataChannelListener
|
||||
nsDOMDataChannel::~nsDOMDataChannel()
|
||||
{
|
||||
public:
|
||||
nsDOMDataChannel(already_AddRefed<mozilla::DataChannel> aDataChannel)
|
||||
: mDataChannel(aDataChannel)
|
||||
, mBinaryType(DC_BINARY_TYPE_BLOB)
|
||||
{}
|
||||
// Don't call us anymore! Likely isn't an issue (or maybe just less of
|
||||
// one) once we block GC until all the (appropriate) onXxxx handlers
|
||||
// are dropped. (See WebRTC spec)
|
||||
LOG(("Close()ing %p", mDataChannel.get()));
|
||||
mDataChannel->SetListener(nullptr, nullptr);
|
||||
mDataChannel->Close();
|
||||
}
|
||||
|
||||
~nsDOMDataChannel()
|
||||
{
|
||||
// Don't call us anymore! Likely isn't an issue (or maybe just less of
|
||||
// one) once we block GC until all the (appropriate) onXxxx handlers
|
||||
// are dropped. (See WebRTC spec)
|
||||
LOG(("Close()ing %p", mDataChannel.get()));
|
||||
mDataChannel->SetListener(nullptr, nullptr);
|
||||
mDataChannel->Close();
|
||||
}
|
||||
|
||||
nsresult Init(nsPIDOMWindow* aDOMWindow);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMDATACHANNEL
|
||||
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMDataChannel,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
nsresult
|
||||
DoOnMessageAvailable(const nsACString& aMessage, bool aBinary);
|
||||
|
||||
virtual nsresult
|
||||
OnMessageAvailable(nsISupports* aContext, const nsACString& aMessage);
|
||||
|
||||
virtual nsresult
|
||||
OnBinaryMessageAvailable(nsISupports* aContext, const nsACString& aMessage);
|
||||
|
||||
virtual nsresult OnSimpleEvent(nsISupports* aContext, const nsAString& aName);
|
||||
|
||||
virtual nsresult
|
||||
OnChannelConnected(nsISupports* aContext);
|
||||
|
||||
virtual nsresult
|
||||
OnChannelClosed(nsISupports* aContext);
|
||||
|
||||
virtual void
|
||||
AppReady();
|
||||
|
||||
private:
|
||||
// Get msg info out of JS variable being sent (string, arraybuffer, blob)
|
||||
nsresult GetSendParams(nsIVariant *aData, nsCString &aStringOut,
|
||||
nsCOMPtr<nsIInputStream> &aStreamOut,
|
||||
bool &aIsBinary, uint32_t &aOutgoingLength);
|
||||
|
||||
// Owning reference
|
||||
nsRefPtr<mozilla::DataChannel> mDataChannel;
|
||||
nsString mOrigin;
|
||||
enum
|
||||
{
|
||||
DC_BINARY_TYPE_ARRAYBUFFER,
|
||||
DC_BINARY_TYPE_BLOB,
|
||||
} mBinaryType;
|
||||
};
|
||||
|
||||
DOMCI_DATA(DataChannel, nsDOMDataChannel)
|
||||
/* virtual */ JSObject*
|
||||
nsDOMDataChannel::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return DataChannelBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMDataChannel,
|
||||
nsDOMEventTargetHelper)
|
||||
|
@ -127,7 +68,6 @@ NS_IMPL_RELEASE_INHERITED(nsDOMDataChannel, nsDOMEventTargetHelper)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDataChannel)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DataChannel)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
nsresult
|
||||
|
@ -185,28 +125,53 @@ nsDOMDataChannel::GetProtocol(nsAString& aProtocol)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
nsDOMDataChannel::Stream() const
|
||||
{
|
||||
return mDataChannel->GetStream();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::GetStream(uint16_t *aStream)
|
||||
{
|
||||
mDataChannel->GetStream(aStream);
|
||||
*aStream = Stream();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX should be GetType()? Open question for the spec
|
||||
bool
|
||||
nsDOMDataChannel::Reliable() const
|
||||
{
|
||||
return mDataChannel->GetType() == mozilla::DataChannelConnection::RELIABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::GetReliable(bool* aReliable)
|
||||
{
|
||||
*aReliable = (mDataChannel->GetType() == mozilla::DataChannelConnection::RELIABLE);
|
||||
*aReliable = Reliable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMDataChannel::Ordered() const
|
||||
{
|
||||
return mDataChannel->GetOrdered();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::GetOrdered(bool* aOrdered)
|
||||
{
|
||||
*aOrdered = mDataChannel->GetOrdered();
|
||||
*aOrdered = Ordered();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RTCDataChannelState
|
||||
nsDOMDataChannel::ReadyState() const
|
||||
{
|
||||
return static_cast<RTCDataChannelState>(mDataChannel->GetReadyState());
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::GetReadyState(nsAString& aReadyState)
|
||||
{
|
||||
|
@ -225,10 +190,16 @@ nsDOMDataChannel::GetReadyState(nsAString& aReadyState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsDOMDataChannel::BufferedAmount() const
|
||||
{
|
||||
return mDataChannel->GetBufferedAmount();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::GetBufferedAmount(uint32_t* aBufferedAmount)
|
||||
{
|
||||
*aBufferedAmount = mDataChannel->GetBufferedAmount();
|
||||
*aBufferedAmount = BufferedAmount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -267,9 +238,73 @@ nsDOMDataChannel::Close()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Almost a clone of nsWebSocketChannel::Send()
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::Send(nsIVariant* aData)
|
||||
// All of the following is copy/pasted from WebSocket.cpp.
|
||||
void
|
||||
nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 msgString(aData);
|
||||
Send(nullptr, msgString, msgString.Length(), false, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::Send(nsIDOMBlob* aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
nsresult rv = aData->GetInternalStream(getter_AddRefs(msgStream));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t msgLength;
|
||||
rv = aData->GetSize(&msgLength);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgLength > UINT32_MAX) {
|
||||
aRv.Throw(NS_ERROR_FILE_TOO_BIG);
|
||||
return;
|
||||
}
|
||||
|
||||
Send(msgStream, EmptyCString(), msgLength, true, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::Send(ArrayBuffer& aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
MOZ_ASSERT(sizeof(*aData.Data()) == 1);
|
||||
uint32_t len = aData.Length();
|
||||
char* data = reinterpret_cast<char*>(aData.Data());
|
||||
|
||||
nsDependentCSubstring msgString(data, len);
|
||||
Send(nullptr, msgString, len, true, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::Send(ArrayBufferView& aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
MOZ_ASSERT(sizeof(*aData.Data()) == 1);
|
||||
uint32_t len = aData.Length();
|
||||
char* data = reinterpret_cast<char*>(aData.Data());
|
||||
|
||||
nsDependentCSubstring msgString(data, len);
|
||||
Send(nullptr, msgString, len, true, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::Send(nsIInputStream* aMsgStream,
|
||||
const nsACString& aMsgString,
|
||||
uint32_t aMsgLength,
|
||||
bool aIsBinary,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
uint16_t state = mDataChannel->GetReadyState();
|
||||
|
@ -277,110 +312,31 @@ nsDOMDataChannel::Send(nsIVariant* aData)
|
|||
// In reality, the DataChannel protocol allows this, but we want it to
|
||||
// look like WebSockets
|
||||
if (state == mozilla::DataChannel::CONNECTING) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCString msgString;
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
bool isBinary;
|
||||
uint32_t msgLen;
|
||||
nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state == mozilla::DataChannel::CLOSING ||
|
||||
state == mozilla::DataChannel::CLOSED) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(state == mozilla::DataChannel::OPEN,
|
||||
"Unknown state in nsWebSocket::Send");
|
||||
"Unknown state in nsDOMDataChannel::Send");
|
||||
|
||||
int32_t sent;
|
||||
if (msgStream) {
|
||||
sent = mDataChannel->SendBinaryStream(msgStream, msgLen);
|
||||
if (aMsgStream) {
|
||||
sent = mDataChannel->SendBinaryStream(aMsgStream, aMsgLength);
|
||||
} else {
|
||||
if (isBinary) {
|
||||
sent = mDataChannel->SendBinaryMsg(msgString);
|
||||
if (aIsBinary) {
|
||||
sent = mDataChannel->SendBinaryMsg(aMsgString);
|
||||
} else {
|
||||
sent = mDataChannel->SendMsg(msgString);
|
||||
sent = mDataChannel->SendMsg(aMsgString);
|
||||
}
|
||||
}
|
||||
return sent >= 0 ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX Exact clone of nsWebSocketChannel::GetSendParams() - find a way to share!
|
||||
nsresult
|
||||
nsDOMDataChannel::GetSendParams(nsIVariant* aData, nsCString& aStringOut,
|
||||
nsCOMPtr<nsIInputStream>& aStreamOut,
|
||||
bool& aIsBinary, uint32_t& aOutgoingLength)
|
||||
{
|
||||
// Get type of data (arraybuffer, blob, or string)
|
||||
uint16_t dataType;
|
||||
nsresult rv = aData->GetDataType(&dataType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (dataType == nsIDataType::VTYPE_INTERFACE ||
|
||||
dataType == nsIDataType::VTYPE_INTERFACE_IS) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
nsID* iid;
|
||||
rv = aData->GetAsInterface(&iid, getter_AddRefs(supports));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsMemory::Free(iid);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
// ArrayBuffer?
|
||||
JS::Rooted<JS::Value> realVal(cx);
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
nsresult rv = aData->GetAsJSVal(realVal.address());
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal) &&
|
||||
(obj = JSVAL_TO_OBJECT(realVal)) &&
|
||||
(JS_IsArrayBufferObject(obj))) {
|
||||
int32_t len = JS_GetArrayBufferByteLength(obj);
|
||||
char* data = reinterpret_cast<char*>(JS_GetArrayBufferData(obj));
|
||||
|
||||
aStringOut.Assign(data, len);
|
||||
aIsBinary = true;
|
||||
aOutgoingLength = len;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Blob?
|
||||
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(supports);
|
||||
if (blob) {
|
||||
rv = blob->GetInternalStream(getter_AddRefs(aStreamOut));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// GetSize() should not perform blocking I/O (unlike Available())
|
||||
uint64_t blobLen;
|
||||
rv = blob->GetSize(&blobLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (blobLen > UINT32_MAX) {
|
||||
return NS_ERROR_FILE_TOO_BIG;
|
||||
}
|
||||
aOutgoingLength = static_cast<uint32_t>(blobLen);
|
||||
|
||||
aIsBinary = true;
|
||||
return NS_OK;
|
||||
}
|
||||
if (sent < 0) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
// Text message: if not already a string, turn it into one.
|
||||
// TODO: bug 704444: Correctly coerce any JS type to string
|
||||
//
|
||||
PRUnichar* data = nullptr;
|
||||
uint32_t len = 0;
|
||||
rv = aData->GetAsWStringWithSize(&len, &data);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString text;
|
||||
text.Adopt(data, len);
|
||||
|
||||
CopyUTF16toUTF8(text, aStringOut);
|
||||
|
||||
aIsBinary = false;
|
||||
aOutgoingLength = aStringOut.Length();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -4,27 +4,107 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMDataChannel_h__
|
||||
#define nsDOMDataChannel_h__
|
||||
#ifndef nsDOMDataChannel_h
|
||||
#define nsDOMDataChannel_h
|
||||
|
||||
// This defines only what's necessary to create nsDOMDataChannels, since this
|
||||
// gets used with MOZ_INTERNAL_API not set for media/webrtc/signaling/testing
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/dom/DataChannelBinding.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/net/DataChannel.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIDOMDataChannel.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DataChannel;
|
||||
}
|
||||
class nsDOMDataChannel : public nsDOMEventTargetHelper,
|
||||
public nsIDOMDataChannel,
|
||||
public mozilla::DataChannelListener
|
||||
{
|
||||
public:
|
||||
nsDOMDataChannel(already_AddRefed<mozilla::DataChannel> aDataChannel)
|
||||
: mDataChannel(aDataChannel)
|
||||
, mBinaryType(DC_BINARY_TYPE_BLOB)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
class nsPIDOMWindow;
|
||||
~nsDOMDataChannel();
|
||||
|
||||
nsresult
|
||||
NS_NewDOMDataChannel(already_AddRefed<mozilla::DataChannel> dataChannel,
|
||||
nsPIDOMWindow* aWindow,
|
||||
nsIDOMDataChannel** domDataChannel);
|
||||
nsresult Init(nsPIDOMWindow* aDOMWindow);
|
||||
|
||||
// Tell DataChannel it's ok to deliver open and message events
|
||||
void NS_DataChannelAppReady(nsIDOMDataChannel* domDataChannel);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMDATACHANNEL
|
||||
|
||||
#endif
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMDataChannel,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
MOZ_OVERRIDE;
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
{
|
||||
return GetOwner();
|
||||
}
|
||||
|
||||
// WebIDL
|
||||
// Uses XPIDL GetLabel.
|
||||
bool Reliable() const;
|
||||
mozilla::dom::RTCDataChannelState ReadyState() const;
|
||||
uint32_t BufferedAmount() const;
|
||||
IMPL_EVENT_HANDLER(open)
|
||||
IMPL_EVENT_HANDLER(error)
|
||||
IMPL_EVENT_HANDLER(close)
|
||||
// Uses XPIDL Close.
|
||||
IMPL_EVENT_HANDLER(message)
|
||||
mozilla::dom::RTCDataChannelType BinaryType() const
|
||||
{
|
||||
return static_cast<mozilla::dom::RTCDataChannelType>(
|
||||
static_cast<int>(mBinaryType));
|
||||
}
|
||||
void SetBinaryType(mozilla::dom::RTCDataChannelType aType)
|
||||
{
|
||||
mBinaryType = static_cast<DataChannelBinaryType>(
|
||||
static_cast<int>(aType));
|
||||
}
|
||||
void Send(const nsAString& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(nsIDOMBlob* aData, mozilla::ErrorResult& aRv);
|
||||
void Send(mozilla::dom::ArrayBuffer& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(mozilla::dom::ArrayBufferView& aData, mozilla::ErrorResult& aRv);
|
||||
|
||||
// Uses XPIDL GetProtocol.
|
||||
bool Ordered() const;
|
||||
uint16_t Stream() const;
|
||||
|
||||
nsresult
|
||||
DoOnMessageAvailable(const nsACString& aMessage, bool aBinary);
|
||||
|
||||
virtual nsresult
|
||||
OnMessageAvailable(nsISupports* aContext, const nsACString& aMessage);
|
||||
|
||||
virtual nsresult
|
||||
OnBinaryMessageAvailable(nsISupports* aContext, const nsACString& aMessage);
|
||||
|
||||
virtual nsresult OnSimpleEvent(nsISupports* aContext, const nsAString& aName);
|
||||
|
||||
virtual nsresult
|
||||
OnChannelConnected(nsISupports* aContext);
|
||||
|
||||
virtual nsresult
|
||||
OnChannelClosed(nsISupports* aContext);
|
||||
|
||||
virtual void
|
||||
AppReady();
|
||||
|
||||
private:
|
||||
void Send(nsIInputStream* aMsgStream, const nsACString& aMsgString,
|
||||
uint32_t aMsgLength, bool aIsBinary, mozilla::ErrorResult& aRv);
|
||||
|
||||
// Owning reference
|
||||
nsRefPtr<mozilla::DataChannel> mDataChannel;
|
||||
nsString mOrigin;
|
||||
enum DataChannelBinaryType {
|
||||
DC_BINARY_TYPE_ARRAYBUFFER,
|
||||
DC_BINARY_TYPE_BLOB,
|
||||
};
|
||||
DataChannelBinaryType mBinaryType;
|
||||
};
|
||||
|
||||
#endif // nsDOMDataChannel_h
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMDataChannelDeclarations_h
|
||||
#define nsDOMDataChannelDeclarations_h
|
||||
|
||||
// This defines only what's necessary to create nsDOMDataChannels, since this
|
||||
// gets used with MOZ_INTERNAL_API not set for media/webrtc/signaling/testing
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMDataChannel.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DataChannel;
|
||||
}
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMDataChannel(already_AddRefed<mozilla::DataChannel> dataChannel,
|
||||
nsPIDOMWindow* aWindow,
|
||||
nsIDOMDataChannel** domDataChannel);
|
||||
|
||||
// Tell DataChannel it's ok to deliver open and message events
|
||||
void NS_DataChannelAppReady(nsIDOMDataChannel* domDataChannel);
|
||||
|
||||
#endif // nsDOMDataChannelDeclarations_h
|
|
@ -2204,7 +2204,7 @@ public:
|
|||
|
||||
nsRefPtr<nsFrameMessageManager> mm = tabChild->GetInnerManager();
|
||||
mm->ReceiveMessage(static_cast<EventTarget*>(tabChild), mMessage,
|
||||
false, &data, nullptr, nullptr, nullptr);
|
||||
false, &data, JS::NullPtr(), nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -626,7 +626,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
const nsAString& aMessage,
|
||||
bool aSync,
|
||||
const StructuredCloneData* aCloneData,
|
||||
JSObject* aObjectsArray,
|
||||
JS::Handle<JSObject*> aObjectsArray,
|
||||
InfallibleTArray<nsString>* aJSONRetVal,
|
||||
JSContext* aContext)
|
||||
{
|
||||
|
@ -646,8 +646,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
if (!wrappedJS) {
|
||||
continue;
|
||||
}
|
||||
JS::Rooted<JSObject*> object(ctx);
|
||||
wrappedJS->GetJSObject(object.address());
|
||||
JS::Rooted<JSObject*> object(ctx, wrappedJS->GetJSObject());
|
||||
if (!object) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1009,8 +1008,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
// Need to scope JSAutoRequest to happen after Push but before Pop,
|
||||
// at least for now. See bug 584673.
|
||||
JSAutoRequest ar(mCx);
|
||||
JS::Rooted<JSObject*> global(mCx);
|
||||
mGlobal->GetJSObject(global.address());
|
||||
JS::Rooted<JSObject*> global(mCx, mGlobal->GetJSObject());
|
||||
if (global) {
|
||||
(void) JS_ExecuteScript(mCx, global, holder->mScript, nullptr);
|
||||
}
|
||||
|
@ -1068,8 +1066,7 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
|||
// Need to scope JSAutoRequest to happen after Push but before Pop,
|
||||
// at least for now. See bug 584673.
|
||||
JSAutoRequest ar(mCx);
|
||||
JS::Rooted<JSObject*> global(mCx);
|
||||
mGlobal->GetJSObject(global.address());
|
||||
JS::Rooted<JSObject*> global(mCx, mGlobal->GetJSObject());
|
||||
if (global) {
|
||||
JSAutoCompartment ac(mCx, global);
|
||||
JS::CompileOptions options(mCx);
|
||||
|
@ -1138,9 +1135,8 @@ nsFrameScriptExecutor::InitTabChildGlobalInternal(nsISupports* aScope,
|
|||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
|
||||
JS::Rooted<JSObject*> global(cx);
|
||||
rv = mGlobal->GetJSObject(global.address());
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
|
||||
NS_ENSURE_TRUE(global, false);
|
||||
|
||||
JS_SetGlobalObject(cx, global);
|
||||
|
||||
|
@ -1206,7 +1202,7 @@ public:
|
|||
|
||||
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sChildProcessManager;
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()), mMessage,
|
||||
false, &data, nullptr, nullptr, nullptr);
|
||||
false, &data, JS::NullPtr(), nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1336,7 +1332,7 @@ public:
|
|||
nsRefPtr<nsFrameMessageManager> ppm =
|
||||
nsFrameMessageManager::sSameProcessParentManager;
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
mMessage, false, &data, nullptr, nullptr, nullptr);
|
||||
mMessage, false, &data, JS::NullPtr(), nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1376,7 +1372,7 @@ public:
|
|||
if (nsFrameMessageManager::sSameProcessParentManager) {
|
||||
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sSameProcessParentManager;
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()), aMessage,
|
||||
true, &aData, nullptr, aJSONRetVal);
|
||||
true, &aData, JS::NullPtr(), aJSONRetVal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, const nsAString& aMessage,
|
||||
bool aSync, const StructuredCloneData* aCloneData,
|
||||
JSObject* aObjectsArray,
|
||||
JS::Handle<JSObject*> aObjectsArray,
|
||||
InfallibleTArray<nsString>* aJSONRetVal,
|
||||
JSContext* aContext = nullptr);
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ nsInProcessTabChildGlobal::DoSendSyncMessage(const nsAString& aMessage,
|
|||
}
|
||||
if (mChromeMessageManager) {
|
||||
nsRefPtr<nsFrameMessageManager> mm = mChromeMessageManager;
|
||||
mm->ReceiveMessage(mOwner, aMessage, true, &aData, nullptr, aJSONRetVal);
|
||||
mm->ReceiveMessage(mOwner, aMessage, true, &aData, JS::NullPtr(),
|
||||
aJSONRetVal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -73,7 +74,7 @@ public:
|
|||
|
||||
nsRefPtr<nsFrameMessageManager> mm = mTabChild->mChromeMessageManager;
|
||||
mm->ReceiveMessage(mTabChild->mOwner, mMessage, false, &data,
|
||||
nullptr, nullptr, nullptr);
|
||||
JS::NullPtr(), nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -121,10 +121,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject* global;
|
||||
mGlobal->GetJSObject(&global);
|
||||
|
||||
return global;
|
||||
return mGlobal->GetJSObject();
|
||||
}
|
||||
protected:
|
||||
nsresult Init();
|
||||
|
|
|
@ -4292,13 +4292,10 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
|||
int compileOptions = SH_ATTRIBUTES_UNIFORMS |
|
||||
SH_ENFORCE_PACKING_RESTRICTIONS;
|
||||
|
||||
// we want to do this everywhere, but:
|
||||
//TODO: Enable on windows:
|
||||
#ifndef XP_WIN // to do this on Windows, we need ANGLE r1719, 1733, 1734.
|
||||
#ifndef XP_MACOSX // to do this on Mac, we need to do it only on Mac OSX > 10.6 as this
|
||||
// We want to do this everywhere, but:
|
||||
#ifndef XP_MACOSX // To do this on Mac, we need to do it only on Mac OSX > 10.6 as this
|
||||
// causes the shader compiler in 10.6 to crash
|
||||
compileOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (useShaderSourceTranslation) {
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
#ifndef mozilla_dom_Touch_h
|
||||
#define mozilla_dom_Touch_h
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -165,7 +165,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMEventTargetHelper,
|
|||
return GetEventHandler(nsGkAtoms::on##_event); \
|
||||
} \
|
||||
inline void SetOn##_event(mozilla::dom::EventHandlerNonNull* aCallback, \
|
||||
ErrorResult& aRv) \
|
||||
mozilla::ErrorResult& aRv) \
|
||||
{ \
|
||||
SetEventHandler(nsGkAtoms::on##_event, aCallback, aRv); \
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMKeyboardEvent.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
nsDOMKeyboardEvent::nsDOMKeyboardEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -35,11 +34,8 @@ nsDOMKeyboardEvent::~nsDOMKeyboardEvent()
|
|||
NS_IMPL_ADDREF_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent)
|
||||
|
||||
DOMCI_DATA(KeyboardEvent, nsDOMKeyboardEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMKeyboardEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(KeyboardEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -84,8 +84,8 @@ nsEventListenerInfo::GetJSVal(JSContext* aCx,
|
|||
*aJSVal = JSVAL_NULL;
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(mListener);
|
||||
if (wrappedJS) {
|
||||
JS::Rooted<JSObject*> object(aCx, nullptr);
|
||||
if (NS_FAILED(wrappedJS->GetJSObject(object.address()))) {
|
||||
JS::Rooted<JSObject*> object(aCx, wrappedJS->GetJSObject());
|
||||
if (!object) {
|
||||
return false;
|
||||
}
|
||||
aAc.construct(aCx, object);
|
||||
|
|
|
@ -26,8 +26,10 @@ public:
|
|||
|
||||
IUnknown* GetDXVADeviceManager() MOZ_OVERRIDE;
|
||||
|
||||
// Copies a region (aRegion) of the video frame stored in aVideoSample
|
||||
// into an image which is returned by aOutImage.
|
||||
HRESULT CopyToImage(IMFSample* aVideoSample,
|
||||
const nsIntSize& aSize,
|
||||
const nsIntRect& aRegion,
|
||||
ImageContainer* aContainer,
|
||||
Image** aOutImage) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -137,7 +139,7 @@ D3D9DXVA2Manager::Init()
|
|||
|
||||
HRESULT
|
||||
D3D9DXVA2Manager::CopyToImage(IMFSample* aSample,
|
||||
const nsIntSize& aSize,
|
||||
const nsIntRect& aRegion,
|
||||
ImageContainer* aImageContainer,
|
||||
Image** aOutImage)
|
||||
{
|
||||
|
@ -159,7 +161,7 @@ D3D9DXVA2Manager::CopyToImage(IMFSample* aSample,
|
|||
"Wrong format?");
|
||||
|
||||
D3D9SurfaceImage* videoImage = static_cast<D3D9SurfaceImage*>(image.get());
|
||||
hr = videoImage->SetData(D3D9SurfaceImage::Data(surface, aSize));
|
||||
hr = videoImage->SetData(D3D9SurfaceImage::Data(surface, aRegion));
|
||||
|
||||
image.forget(aOutImage);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "WMF.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIntSize;
|
||||
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
|
||||
// Creates an Image for the video frame stored in aVideoSample.
|
||||
virtual HRESULT CopyToImage(IMFSample* aVideoSample,
|
||||
const nsIntSize& aSize,
|
||||
const nsIntRect& aRegion,
|
||||
layers::ImageContainer* aContainer,
|
||||
layers::Image** aOutImage) = 0;
|
||||
|
||||
|
|
|
@ -791,7 +791,7 @@ WMFReader::CreateD3DVideoFrame(IMFSample* aSample,
|
|||
|
||||
nsRefPtr<Image> image;
|
||||
hr = mDXVA2Manager->CopyToImage(aSample,
|
||||
nsIntSize(mPictureRegion.width, mPictureRegion.height),
|
||||
mPictureRegion,
|
||||
mDecoder->GetImageContainer(),
|
||||
getter_AddRefs(image));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
|
|
@ -35,19 +35,15 @@ SVGAnimatedRect::~SVGAnimatedRect()
|
|||
}
|
||||
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGAnimatedRect::GetBaseVal(ErrorResult& aRv)
|
||||
SVGAnimatedRect::GetBaseVal()
|
||||
{
|
||||
nsRefPtr<SVGIRect> rect;
|
||||
aRv = mVal->ToDOMBaseVal(getter_AddRefs(rect), mSVGElement);
|
||||
return rect.forget();
|
||||
return mVal->ToDOMBaseVal(mSVGElement);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGAnimatedRect::GetAnimVal(ErrorResult& aRv)
|
||||
SVGAnimatedRect::GetAnimVal()
|
||||
{
|
||||
nsRefPtr<SVGIRect> rect;
|
||||
aRv = mVal->ToDOMAnimVal(getter_AddRefs(rect), mSVGElement);
|
||||
return rect.forget();
|
||||
return mVal->ToDOMAnimVal(mSVGElement);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
|
|
@ -37,9 +37,9 @@ public:
|
|||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
already_AddRefed<SVGIRect> GetBaseVal(ErrorResult& aRv);
|
||||
already_AddRefed<SVGIRect> GetBaseVal();
|
||||
|
||||
already_AddRefed<SVGIRect> GetAnimVal(ErrorResult& aRv);
|
||||
already_AddRefed<SVGIRect> GetAnimVal();
|
||||
|
||||
private:
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
|
|
|
@ -109,9 +109,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMarkerElement)
|
|||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGMarkerElement::ViewBox()
|
||||
{
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
return mViewBox.ToSVGAnimatedRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
|
|
|
@ -67,9 +67,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
|
|||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGPatternElement::ViewBox()
|
||||
{
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
return mViewBox.ToSVGAnimatedRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
|
|
|
@ -445,9 +445,7 @@ SVGSVGElement::GetElementById(const nsAString& elementId, ErrorResult& rv)
|
|||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGSVGElement::ViewBox()
|
||||
{
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
return mViewBox.ToSVGAnimatedRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
|
|
|
@ -43,9 +43,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
|
|||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGSymbolElement::ViewBox()
|
||||
{
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
return mViewBox.ToSVGAnimatedRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
|
|
|
@ -67,9 +67,7 @@ SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
|||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGViewElement::ViewBox()
|
||||
{
|
||||
nsRefPtr<SVGAnimatedRect> box;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(box), this);
|
||||
return box.forget();
|
||||
return mViewBox.ToSVGAnimatedRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
|
|
|
@ -57,7 +57,7 @@ static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMBaseVal>
|
|||
sBaseSVGViewBoxTearoffTable;
|
||||
static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMAnimVal>
|
||||
sAnimSVGViewBoxTearoffTable;
|
||||
nsSVGAttrTearoffTable<nsSVGViewBox, mozilla::dom::SVGAnimatedRect>
|
||||
nsSVGAttrTearoffTable<nsSVGViewBox, dom::SVGAnimatedRect>
|
||||
nsSVGViewBox::sSVGAnimatedRectTearoffTable;
|
||||
|
||||
|
||||
|
@ -198,9 +198,9 @@ nsSVGViewBox::GetBaseValueString(nsAString& aValue) const
|
|||
aValue.Assign(buf);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMAnimatedRect(dom::SVGAnimatedRect **aResult,
|
||||
nsSVGElement* aSVGElement)
|
||||
|
||||
already_AddRefed<dom::SVGAnimatedRect>
|
||||
nsSVGViewBox::ToSVGAnimatedRect(nsSVGElement* aSVGElement)
|
||||
{
|
||||
nsRefPtr<dom::SVGAnimatedRect> domAnimatedRect =
|
||||
sSVGAnimatedRectTearoffTable.GetTearoff(this);
|
||||
|
@ -209,18 +209,16 @@ nsSVGViewBox::ToDOMAnimatedRect(dom::SVGAnimatedRect **aResult,
|
|||
sSVGAnimatedRectTearoffTable.AddTearoff(this, domAnimatedRect);
|
||||
}
|
||||
|
||||
domAnimatedRect.forget(aResult);
|
||||
return NS_OK;
|
||||
return domAnimatedRect.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMBaseVal(dom::SVGIRect **aResult,
|
||||
nsSVGElement *aSVGElement)
|
||||
already_AddRefed<dom::SVGIRect>
|
||||
nsSVGViewBox::ToDOMBaseVal(nsSVGElement *aSVGElement)
|
||||
{
|
||||
if (!mHasBaseVal || mBaseVal.none) {
|
||||
*aResult = nullptr;
|
||||
return NS_OK;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMBaseVal> domBaseVal =
|
||||
sBaseSVGViewBoxTearoffTable.GetTearoff(this);
|
||||
if (!domBaseVal) {
|
||||
|
@ -228,8 +226,7 @@ nsSVGViewBox::ToDOMBaseVal(dom::SVGIRect **aResult,
|
|||
sBaseSVGViewBoxTearoffTable.AddTearoff(this, domBaseVal);
|
||||
}
|
||||
|
||||
domBaseVal.forget(aResult);
|
||||
return NS_OK;
|
||||
return domBaseVal.forget();
|
||||
}
|
||||
|
||||
nsSVGViewBox::DOMBaseVal::~DOMBaseVal()
|
||||
|
@ -237,15 +234,14 @@ nsSVGViewBox::DOMBaseVal::~DOMBaseVal()
|
|||
sBaseSVGViewBoxTearoffTable.RemoveTearoff(mVal);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMAnimVal(dom::SVGIRect **aResult,
|
||||
nsSVGElement *aSVGElement)
|
||||
already_AddRefed<dom::SVGIRect>
|
||||
nsSVGViewBox::ToDOMAnimVal(nsSVGElement *aSVGElement)
|
||||
{
|
||||
if ((mAnimVal && mAnimVal->none) ||
|
||||
(!mAnimVal && (!mHasBaseVal || mBaseVal.none))) {
|
||||
*aResult = nullptr;
|
||||
return NS_OK;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMAnimVal> domAnimVal =
|
||||
sAnimSVGViewBoxTearoffTable.GetTearoff(this);
|
||||
if (!domAnimVal) {
|
||||
|
@ -253,8 +249,7 @@ nsSVGViewBox::ToDOMAnimVal(dom::SVGIRect **aResult,
|
|||
sAnimSVGViewBoxTearoffTable.AddTearoff(this, domAnimVal);
|
||||
}
|
||||
|
||||
domAnimVal.forget(aResult);
|
||||
return NS_OK;
|
||||
return domAnimVal.forget();
|
||||
}
|
||||
|
||||
nsSVGViewBox::DOMAnimVal::~DOMAnimVal()
|
||||
|
|
|
@ -80,12 +80,15 @@ public:
|
|||
bool aDoSetAttr);
|
||||
void GetBaseValueString(nsAString& aValue) const;
|
||||
|
||||
nsresult ToDOMAnimatedRect(mozilla::dom::SVGAnimatedRect **aResult,
|
||||
nsSVGElement *aSVGElement);
|
||||
nsresult ToDOMBaseVal(mozilla::dom::SVGIRect **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
nsresult ToDOMAnimVal(mozilla::dom::SVGIRect **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
already_AddRefed<mozilla::dom::SVGAnimatedRect>
|
||||
ToSVGAnimatedRect(nsSVGElement *aSVGElement);
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGIRect>
|
||||
ToDOMBaseVal(nsSVGElement* aSVGElement);
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGIRect>
|
||||
ToDOMAnimVal(nsSVGElement* aSVGElement);
|
||||
|
||||
// Returns a new nsISMILAttr object that the caller must delete
|
||||
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
|||
if (!targetObjectIsNew)
|
||||
return NS_OK;
|
||||
|
||||
JS::Rooted<JSObject*> targetScriptObject(context->GetNativeContext());
|
||||
holder->GetJSObject(targetScriptObject.address());
|
||||
JS::Rooted<JSObject*> targetScriptObject(context->GetNativeContext(),
|
||||
holder->GetJSObject());
|
||||
|
||||
AutoPushJSContext cx(context->GetNativeContext());
|
||||
JSAutoRequest ar(cx);
|
||||
|
|
|
@ -264,7 +264,8 @@ nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
|
|||
rv = aStream->WriteWStringZ(mName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
|
||||
return XBL_SerializeFunction(aContext, aStream,
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(&mJSMethodObject));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -369,7 +370,8 @@ nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext,
|
|||
nsresult rv = aStream->Write8(aType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
|
||||
rv = XBL_SerializeFunction(aContext, aStream,
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(&mJSMethodObject));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -373,12 +373,14 @@ nsXBLProtoImplProperty::Write(nsIScriptContext* aContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mJSAttributes & JSPROP_GETTER) {
|
||||
rv = XBL_SerializeFunction(aContext, aStream, mJSGetterObject);
|
||||
rv = XBL_SerializeFunction(aContext, aStream,
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(&mJSGetterObject));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (mJSAttributes & JSPROP_SETTER) {
|
||||
rv = XBL_SerializeFunction(aContext, aStream, mJSSetterObject);
|
||||
rv = XBL_SerializeFunction(aContext, aStream,
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(&mJSSetterObject));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,10 @@ using namespace mozilla;
|
|||
nsresult
|
||||
XBL_SerializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
JSObject* aFunctionObject)
|
||||
JS::Handle<JSObject*> aFunction)
|
||||
{
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
JS::RootedObject function(cx, aFunctionObject);
|
||||
return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, function);
|
||||
return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, aFunction);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -79,7 +79,7 @@ PR_STATIC_ASSERT(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuilti
|
|||
nsresult
|
||||
XBL_SerializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
JSObject* aFunctionObject);
|
||||
JS::Handle<JSObject*> aFunctionObject);
|
||||
|
||||
nsresult
|
||||
XBL_DeserializeFunction(nsIScriptContext* aContext,
|
||||
|
|
|
@ -1438,9 +1438,8 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
|
|||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
NS_ENSURE_TRUE(cx, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
JS::RootedObject jsobj(cx);
|
||||
rv = holder->GetJSObject(jsobj.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::RootedObject jsobj(cx, holder->GetJSObject());
|
||||
NS_ENSURE_STATE(jsobj);
|
||||
|
||||
JS::RootedString str(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
|
||||
NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -2526,7 +2526,7 @@ nsXULPrototypeScript::DeserializeOutOfLine(nsIObjectInputStream* aInput,
|
|||
bool isChrome = false;
|
||||
mSrcURI->SchemeIs("chrome", &isChrome);
|
||||
if (isChrome)
|
||||
cache->PutScript(mSrcURI, mScriptObject);
|
||||
cache->PutScript(mSrcURI, GetScriptObject());
|
||||
}
|
||||
cache->FinishInputStream(mSrcURI);
|
||||
} else {
|
||||
|
@ -2628,9 +2628,9 @@ nsXULPrototypeScript::Set(JSScript* aObject)
|
|||
return;
|
||||
}
|
||||
|
||||
mScriptObject = aObject;
|
||||
nsContentUtils::HoldJSObjects(
|
||||
this, NS_CYCLE_COLLECTION_PARTICIPANT(nsXULPrototypeNode));
|
||||
mScriptObject = aObject;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -236,9 +236,13 @@ public:
|
|||
|
||||
void Set(JSScript* aObject);
|
||||
|
||||
JSScript *GetScriptObject()
|
||||
// It's safe to return a handle because we trace mScriptObject, no one ever
|
||||
// uses the handle (or the script object) past the point at which the
|
||||
// nsXULPrototypeScript dies, and we can't get memmoved so the
|
||||
// &mScriptObject pointer can't go stale.
|
||||
JS::Handle<JSScript*> GetScriptObject()
|
||||
{
|
||||
return mScriptObject;
|
||||
return JS::Handle<JSScript*>::fromMarkedLocation(&mScriptObject);
|
||||
}
|
||||
|
||||
void TraceScriptObject(JSTracer* aTrc)
|
||||
|
|
|
@ -3644,7 +3644,8 @@ XULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
|
||||
|
||||
nsresult
|
||||
XULDocument::ExecuteScript(nsIScriptContext * aContext, JSScript* aScriptObject)
|
||||
XULDocument::ExecuteScript(nsIScriptContext * aContext,
|
||||
JS::Handle<JSScript*> aScriptObject)
|
||||
{
|
||||
NS_PRECONDITION(aScriptObject != nullptr && aContext != nullptr, "null ptr");
|
||||
if (! aScriptObject || ! aContext)
|
||||
|
@ -3653,9 +3654,8 @@ XULDocument::ExecuteScript(nsIScriptContext * aContext, JSScript* aScriptObject)
|
|||
NS_ENSURE_TRUE(mScriptGlobalObject, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Execute the precompiled script with the given version
|
||||
JS::Rooted<JSScript*> script(aContext->GetNativeContext(), aScriptObject);
|
||||
JSObject* global = mScriptGlobalObject->GetGlobalJSObject();
|
||||
return aContext->ExecuteScript(script, global);
|
||||
return aContext->ExecuteScript(aScriptObject, global);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -403,7 +403,8 @@ protected:
|
|||
* Execute the precompiled script object scoped by this XUL document's
|
||||
* containing window object, and using its associated script context.
|
||||
*/
|
||||
nsresult ExecuteScript(nsIScriptContext *aContext, JSScript* aScriptObject);
|
||||
nsresult ExecuteScript(nsIScriptContext *aContext,
|
||||
JS::Handle<JSScript*> aScriptObject);
|
||||
|
||||
/**
|
||||
* Helper method for the above that uses aScript to find the appropriate
|
||||
|
|
|
@ -205,7 +205,8 @@ nsXULPrototypeCache::GetScript(nsIURI* aURI)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsXULPrototypeCache::PutScript(nsIURI* aURI, JSScript* aScriptObject)
|
||||
nsXULPrototypeCache::PutScript(nsIURI* aURI,
|
||||
JS::Handle<JSScript*> aScriptObject)
|
||||
{
|
||||
CacheScriptEntry existingEntry;
|
||||
if (mScriptTable.Get(aURI, &existingEntry)) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
nsresult PutPrototype(nsXULPrototypeDocument* aDocument);
|
||||
|
||||
JSScript* GetScript(nsIURI* aURI);
|
||||
nsresult PutScript(nsIURI* aURI, JSScript* aScriptObject);
|
||||
nsresult PutScript(nsIURI* aURI, JS::Handle<JSScript*> aScriptObject);
|
||||
|
||||
nsXBLDocumentInfo* GetXBLDocumentInfo(nsIURI* aURL) {
|
||||
return mXBLDocTable.GetWeak(aURL);
|
||||
|
|
|
@ -139,15 +139,13 @@ AlarmDB.prototype = {
|
|||
"readonly",
|
||||
ALARMSTORE_NAME,
|
||||
function txnCb(aTxn, aStore) {
|
||||
if (!aTxn.result)
|
||||
if (!aTxn.result) {
|
||||
aTxn.result = [];
|
||||
}
|
||||
|
||||
aStore.mozGetAll().onsuccess = function setTxnResult(aEvent) {
|
||||
aEvent.target.result.forEach(function addAlarm(aAlarm) {
|
||||
if (!aManifestURL || aManifestURL == aAlarm.manifestURL)
|
||||
aTxn.result.push(aAlarm);
|
||||
});
|
||||
|
||||
let index = aStore.index("manifestURL");
|
||||
index.mozGetAll(aManifestURL).onsuccess = function setTxnResult(aEvent) {
|
||||
aTxn.result = aEvent.target.result;
|
||||
debug("Request successful. Record count: " + aTxn.result.length);
|
||||
};
|
||||
},
|
||||
|
|
|
@ -368,7 +368,8 @@ WebappsApplication.prototype = {
|
|||
"Webapps:CheckForUpdate:Return:OK",
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:Launch:Return:KO",
|
||||
"Webapps:PackageEvent"]);
|
||||
"Webapps:PackageEvent",
|
||||
"Webapps:ClearBrowserData:Return"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
["Webapps:OfflineCache",
|
||||
|
@ -464,11 +465,26 @@ WebappsApplication.prototype = {
|
|||
},
|
||||
|
||||
clearBrowserData: function() {
|
||||
let request = this.createRequest();
|
||||
let browserChild =
|
||||
BrowserElementPromptService.getBrowserElementChildForWindow(this._window);
|
||||
if (browserChild) {
|
||||
browserChild.messageManager.sendAsyncMessage("Webapps:ClearBrowserData");
|
||||
browserChild.messageManager.sendAsyncMessage(
|
||||
"Webapps:ClearBrowserData",
|
||||
{ manifestURL: this.manifestURL,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) }
|
||||
);
|
||||
} else {
|
||||
let runnable = {
|
||||
run: function run() {
|
||||
Services.DOMRequest.fireError(request, "NO_CLEARABLE_BROWSER");
|
||||
}
|
||||
}
|
||||
Services.tm.currentThread.dispatch(runnable,
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
}
|
||||
return request;
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
|
@ -590,6 +606,9 @@ WebappsApplication.prototype = {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case "Webapps:ClearBrowserData:Return":
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1854,8 +1854,16 @@ this.DOMApplicationRegistry = {
|
|||
app.etag = xhr.getResponseHeader("Etag");
|
||||
app.manifestHash = this.computeManifestHash(manifest);
|
||||
debug("at install package got app etag=" + app.etag);
|
||||
Services.obs.notifyObservers(aMm, "webapps-ask-install",
|
||||
JSON.stringify(aData));
|
||||
// We allow bypassing the install confirmation process to facilitate
|
||||
// automation.
|
||||
let prefName = "dom.mozApps.auto_confirm_install";
|
||||
if (Services.prefs.prefHasUserValue(prefName) &&
|
||||
Services.prefs.getBoolPref(prefName)) {
|
||||
this.confirmInstall(aData);
|
||||
} else {
|
||||
Services.obs.notifyObservers(aMm, "webapps-ask-install",
|
||||
JSON.stringify(aData));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -2011,19 +2019,18 @@ this.DOMApplicationRegistry = {
|
|||
offlineCacheObserver: aOfflineCacheObserver
|
||||
}
|
||||
|
||||
let postFirstInstallTask = (function () {
|
||||
// Only executed on install not involving sync.
|
||||
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
|
||||
this.broadcastMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
|
||||
}).bind(this);
|
||||
// We notify about the successful installation via mgmt.oninstall and the
|
||||
// corresponging DOMRequest.onsuccess event as soon as the app is properly
|
||||
// saved in the registry.
|
||||
if (!aFromSync) {
|
||||
this._saveApps((function() {
|
||||
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
|
||||
this.broadcastMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
if (!aData.isPackage) {
|
||||
if (!aFromSync) {
|
||||
this._saveApps((function() {
|
||||
postFirstInstallTask();
|
||||
}).bind(this));
|
||||
}
|
||||
this.updateAppHandlers(null, app.manifest, app);
|
||||
if (aInstallSuccessCallback) {
|
||||
aInstallSuccessCallback(manifest);
|
||||
|
@ -2067,9 +2074,6 @@ this.DOMApplicationRegistry = {
|
|||
manifestURL: appObject.manifestURL,
|
||||
app: app,
|
||||
manifest: aManifest });
|
||||
if (!aFromSync) {
|
||||
postFirstInstallTask();
|
||||
}
|
||||
if (aInstallSuccessCallback) {
|
||||
aInstallSuccessCallback(aManifest);
|
||||
}
|
||||
|
@ -3015,7 +3019,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
},
|
||||
|
||||
_notifyCategoryAndObservers: function(subject, topic, data) {
|
||||
_notifyCategoryAndObservers: function(subject, topic, data, msg) {
|
||||
const serviceMarker = "service,";
|
||||
|
||||
// First create observers from the category manager.
|
||||
|
@ -3064,6 +3068,8 @@ this.DOMApplicationRegistry = {
|
|||
observer.observe(subject, topic, data);
|
||||
} catch(e) { }
|
||||
});
|
||||
// Send back an answer to the child.
|
||||
ppmm.broadcastAsyncMessage("Webapps:ClearBrowserData:Return", msg);
|
||||
},
|
||||
|
||||
registerBrowserElementParentForApp: function(bep, appId) {
|
||||
|
@ -3080,18 +3086,18 @@ this.DOMApplicationRegistry = {
|
|||
receiveAppMessage: function(appId, message) {
|
||||
switch (message.name) {
|
||||
case "Webapps:ClearBrowserData":
|
||||
this._clearPrivateData(appId, true);
|
||||
this._clearPrivateData(appId, true, message.data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_clearPrivateData: function(appId, browserOnly) {
|
||||
_clearPrivateData: function(appId, browserOnly, msg) {
|
||||
let subject = {
|
||||
appId: appId,
|
||||
browserOnly: browserOnly,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.mozIApplicationClearPrivateDataParams])
|
||||
};
|
||||
this._notifyCategoryAndObservers(subject, "webapps-clear-data", null);
|
||||
this._notifyCategoryAndObservers(subject, "webapps-clear-data", null, msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -12,14 +12,23 @@ relativesrcdir = @relativesrcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
test_app_update.html \
|
||||
file_app.sjs \
|
||||
file_app.template.html \
|
||||
file_hosted_app.template.webapp \
|
||||
file_cached_app.template.webapp \
|
||||
file_cached_app.template.appcache \
|
||||
file_hosted_app.template.webapp \
|
||||
test_app_update.html \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G
|
||||
MOCHITEST_FILES += \
|
||||
file_packaged_app.sjs \
|
||||
file_packaged_app.template.webapp \
|
||||
file_packaged_app.template.html \
|
||||
test_packaged_app_install.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
test_apps_service.xul \
|
||||
$(NULL)
|
||||
|
|
|
@ -40,7 +40,10 @@ function cbError() {
|
|||
function go() {
|
||||
ok(true, "Launched app");
|
||||
var request = window.navigator.mozApps.getSelf();
|
||||
request.onsuccess = function() { var app = request.result; checkApp(app); }
|
||||
request.onsuccess = function() {
|
||||
var app = request.result;
|
||||
checkApp(app);
|
||||
}
|
||||
request.onerror = cbError;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
// From prio.h
|
||||
const PR_RDWR = 0x04;
|
||||
const PR_CREATE_FILE = 0x08;
|
||||
const PR_TRUNCATE = 0x20;
|
||||
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var gBasePath = "tests/dom/apps/tests/";
|
||||
var gMiniManifestTemplate = "file_packaged_app.template.webapp";
|
||||
var gAppTemplate = "file_packaged_app.template.html";
|
||||
var gAppName = "appname";
|
||||
var gDevName = "devname";
|
||||
var gDevUrl = "http://dev.url";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
var query = getQuery(request);
|
||||
|
||||
response.setHeader("Access-Control-Allow-Origin", "*", false);
|
||||
|
||||
var packageSize = ("packageSize" in query) ? query.packageSize : 0;
|
||||
var appName = ("appName" in query) ? query.appName : gAppName;
|
||||
var devName = ("devName" in query) ? query.devName : gDevName;
|
||||
var devUrl = ("devUrl" in query) ? query.devUrl : gDevUrl;
|
||||
|
||||
// If this is a version update, update state, prepare the manifest,
|
||||
// the application package and return.
|
||||
if ("setVersion" in query) {
|
||||
var version = query.setVersion;
|
||||
setState("version", version);
|
||||
|
||||
var packageName = "test_packaged_app_" + version + ".zip";
|
||||
setState("packageName", packageName);
|
||||
var packagePath = "/" + gBasePath + "file_packaged_app.sjs?getPackage=" +
|
||||
packageName;
|
||||
setState("packagePath", packagePath);
|
||||
|
||||
// Create the application package.
|
||||
var zipWriter = Cc["@mozilla.org/zipwriter;1"]
|
||||
.createInstance(Ci.nsIZipWriter);
|
||||
var zipFile = FileUtils.getFile("TmpD", [packageName]);
|
||||
zipWriter.open(zipFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
|
||||
|
||||
// We want to run some tests without the manifest included in the zip.
|
||||
if (version != "0") {
|
||||
var manifestTemplate = gBasePath + gMiniManifestTemplate;
|
||||
var manifest = makeResource(manifestTemplate, version, packagePath,
|
||||
packageSize, appName, devName, devUrl);
|
||||
addZipEntry(zipWriter, manifest, "manifest.webapp");
|
||||
}
|
||||
|
||||
var appTemplate = gBasePath + gAppTemplate;
|
||||
var app = makeResource(appTemplate, version, packagePath, packageSize,
|
||||
appName, devName, devUrl);
|
||||
addZipEntry(zipWriter, app, "index.html");
|
||||
|
||||
zipWriter.close();
|
||||
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write("OK");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the version from server state
|
||||
var version = Number(getState("version"));
|
||||
var packageName = String(getState("packageName"));
|
||||
var packagePath = String(getState("packagePath"));
|
||||
|
||||
var etag = getEtag(request, version);
|
||||
|
||||
if (etagMatches(request, etag)) {
|
||||
dump("Etags Match. Sending 304\n");
|
||||
response.setStatusLine(request.httpVersion, "304", "Not modified");
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Etag", etag, false);
|
||||
|
||||
// Serve the application package corresponding to the requested app version.
|
||||
if ("getPackage" in query) {
|
||||
var resource = readFile(packageName, true);
|
||||
response.setHeader("Content-Type",
|
||||
"Content-Type: application/java-archive", false);
|
||||
response.write(resource);
|
||||
return;
|
||||
}
|
||||
|
||||
// Serve the mini-manifest corresponding to the requested app version.
|
||||
if ("getManifest" in query) {
|
||||
var template = gBasePath + gMiniManifestTemplate;
|
||||
if (!("noManifestContentType" in query)) {
|
||||
response.setHeader("Content-Type",
|
||||
"application/x-web-app-manifest+json", false);
|
||||
}
|
||||
packagePath = "wrongPackagePath" in query ? "" : packagePath;
|
||||
var manifest = makeResource(template, version, packagePath, packageSize,
|
||||
appName, devName, devUrl);
|
||||
response.write(manifest);
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-type", "text-html", false);
|
||||
response.write("KO");
|
||||
}
|
||||
|
||||
function getQuery(request) {
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
return query;
|
||||
}
|
||||
|
||||
function getEtag(request, version) {
|
||||
return request.queryString.replace(/&/g, '-').replace(/=/g, '-') +
|
||||
'-' + version;
|
||||
}
|
||||
|
||||
function etagMatches(request, etag) {
|
||||
return request.hasHeader("If-None-Match") &&
|
||||
request.getHeader("If-None-Match") == etag;
|
||||
}
|
||||
|
||||
// File and resources helpers
|
||||
|
||||
function addZipEntry(zipWriter, entry, entryName) {
|
||||
var stream = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
.createInstance(Ci.nsIStringInputStream);
|
||||
stream.setData(entry, entry.length);
|
||||
zipWriter.addEntryStream(entryName, Date.now(),
|
||||
Ci.nsIZipWriter.COMPRESSION_BEST, stream, false);
|
||||
}
|
||||
|
||||
function readFile(path, fromTmp) {
|
||||
var dir = fromTmp ? "TmpD" : "CurWorkD";
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get(dir, Ci.nsILocalFile);
|
||||
var fstream = Cc["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Ci.nsIFileInputStream);
|
||||
var split = path.split("/");
|
||||
for(var i = 0; i < split.length; ++i) {
|
||||
file.append(split[i]);
|
||||
}
|
||||
fstream.init(file, -1, 0, 0);
|
||||
var data = NetUtil.readInputStreamToString(fstream, fstream.available());
|
||||
fstream.close();
|
||||
return data;
|
||||
}
|
||||
|
||||
function makeResource(templatePath, version, packagePath, packageSize,
|
||||
appName, developerName, developerUrl) {
|
||||
var res = readFile(templatePath, false)
|
||||
.replace(/VERSIONTOKEN/g, version)
|
||||
.replace(/PACKAGEPATHTOKEN/g, packagePath)
|
||||
.replace(/PACKAGESIZETOKEN/g, packageSize)
|
||||
.replace(/NAMETOKEN/g, appName)
|
||||
.replace(/DEVELOPERTOKEN/g, developerName)
|
||||
.replace(/DEVELOPERURLTOKEN/g, developerUrl);
|
||||
return res;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
App Body. Version: VERSIONTOKEN
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name" : "NAMETOKEN",
|
||||
"version" : "VERSIONTOKEN",
|
||||
"size" : PACKAGESIZETOKEN,
|
||||
"package_path": "PACKAGEPATHTOKEN",
|
||||
"description": "Updated even faster than Firefox, just to annoy slashdotters",
|
||||
"launch_path": "tests/dom/apps/tests/file_packaged_app.sjs",
|
||||
"developer": {
|
||||
"name": "DEVELOPERTOKEN",
|
||||
"url": "DEVELOPERURLTOKEN"
|
||||
},
|
||||
"default_locale": "en-US"
|
||||
}
|
|
@ -0,0 +1,401 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id={821589}
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug {821589} Packaged apps installation and update</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={821589}">Mozilla Bug {821589}</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
"use strict";
|
||||
|
||||
var gInstallOrigin = "http://mochi.test:8888";
|
||||
var gSJSPath = "tests/dom/apps/tests/file_packaged_app.sjs";
|
||||
var gSJS = "http://test/" + gSJSPath;
|
||||
var gAppName = "appname";
|
||||
var gApp = null;
|
||||
|
||||
var launchableValue = undefined;
|
||||
|
||||
var index = -1;
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("== Tests debug == " + aMsg + "\n");
|
||||
}
|
||||
|
||||
function next() {
|
||||
index += 1;
|
||||
if (index >= steps.length) {
|
||||
ok(false, "Shouldn't get here!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
steps[index]();
|
||||
} catch(ex) {
|
||||
ok(false, "Caught exception", ex);
|
||||
}
|
||||
}
|
||||
|
||||
function go() {
|
||||
next();
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SpecialPowers.setAllAppsLaunchable(launchableValue);
|
||||
SpecialPowers.removePermission("webapps-manage", document);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function cbError(aError) {
|
||||
ok(false, "Error callback invoked " + aError);
|
||||
finish();
|
||||
}
|
||||
|
||||
function setAppVersion(aVersion, aCb) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", function() {
|
||||
is(xhr.responseText, "OK", "setVersion OK");
|
||||
aCb();
|
||||
});
|
||||
xhr.addEventListener("error", cbError);
|
||||
xhr.addEventListener("abort", cbError);
|
||||
xhr.open("GET", gSJS + "?setVersion=" + aVersion, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function checkAppInstallError(aMiniManifestURL, aExpectedError) {
|
||||
var req = navigator.mozApps.installPackage(aMiniManifestURL);
|
||||
req.onsuccess = function() {
|
||||
ok(false, "We are supposed to throw " + aExpectedError);
|
||||
finish();
|
||||
};
|
||||
req.onerror = function(evt) {
|
||||
var error = evt.target.error.name;
|
||||
if (error == aExpectedError) {
|
||||
ok(true, "Got expected " + aExpectedError);
|
||||
next();
|
||||
} else {
|
||||
ok(false, "Got unexpected " + aError);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function checkUninstallApp(aApp) {
|
||||
var req = navigator.mozApps.mgmt.uninstall(aApp);
|
||||
req.onsuccess = function() {
|
||||
ok(true, "App uninstalled");
|
||||
aApp.ondownloadsuccess = null;
|
||||
aApp.ondownloaderror = null;
|
||||
aApp.onprogress = null;
|
||||
next();
|
||||
};
|
||||
req.onerror = function(evt) {
|
||||
ok(false, "Got unexpected " + evt.target.error.name);
|
||||
finish();
|
||||
};
|
||||
}
|
||||
|
||||
function checkAppDownloadError(aMiniManifestURL,
|
||||
aExpectedError,
|
||||
aVersion,
|
||||
aUninstall,
|
||||
aDownloadAvailable,
|
||||
aName) {
|
||||
var req = navigator.mozApps.installPackage(aMiniManifestURL);
|
||||
req.onsuccess = function() {
|
||||
ok(true, "App installed");
|
||||
};
|
||||
req.onerror = function(evt) {
|
||||
ok(false, "Got unexpected " + evt.target.error.name);
|
||||
finish();
|
||||
};
|
||||
|
||||
navigator.mozApps.mgmt.oninstall = function(evt) {
|
||||
var aApp = evt.application;
|
||||
aApp.ondownloaderror = function(evt) {
|
||||
var error = aApp.downloadError.name;
|
||||
if (error == aExpectedError) {
|
||||
ok(true, "Got expected " + aExpectedError);
|
||||
var expected = {
|
||||
name: aName,
|
||||
manifestURL: aMiniManifestURL,
|
||||
installOrigin: gInstallOrigin,
|
||||
progress: 0,
|
||||
installState: "pending",
|
||||
downloadAvailable: aDownloadAvailable,
|
||||
downloading: false,
|
||||
downloadSize: 0,
|
||||
size: 0,
|
||||
readyToApplyDownload: false,
|
||||
};
|
||||
checkAppState(aApp, aVersion, expected, false, aUninstall, next);
|
||||
} else {
|
||||
ok(false, "Got unexpected " + error);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
aApp.ondownloadsuccess = function(evt) {
|
||||
ok(false, "We are supposed to throw " + aExpectedError);
|
||||
finish();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function checkInstalledApp(aMiniManifestURL,
|
||||
aVersion,
|
||||
aExpectedApp,
|
||||
aLaunchable,
|
||||
aCb) {
|
||||
var req = navigator.mozApps.checkInstalled(aMiniManifestURL);
|
||||
req.onsuccess = function(evt) {
|
||||
ok(true, "The app is installed");
|
||||
checkAppState(evt.application, aVersion, aExpectedApp, aLaunchable,
|
||||
false, aCb);
|
||||
};
|
||||
req.onerror = function() {
|
||||
ok(false, "The app is not installed");
|
||||
finish();
|
||||
};
|
||||
}
|
||||
|
||||
function checkAppState(aApp,
|
||||
aVersion,
|
||||
aExpectedApp,
|
||||
aLaunchable,
|
||||
aUninstall,
|
||||
aCb) {
|
||||
debug(JSON.stringify(aApp, null, 2));
|
||||
if (aApp.manifest) {
|
||||
debug(JSON.stringify(aApp.manifest, null, 2));
|
||||
}
|
||||
|
||||
if (aExpectedApp.name) {
|
||||
if (aApp.manifest) {
|
||||
is(aApp.manifest.name, aExpectedApp.name, "Check name");
|
||||
}
|
||||
is(aApp.updateManifest.name, aExpectedApp.name, "Check name mini-manifest");
|
||||
}
|
||||
if (aApp.manifest) {
|
||||
is(aApp.manifest.version, aVersion, "Check version");
|
||||
}
|
||||
if (typeof aExpectedApp.size !== "undefined" && aApp.manifest) {
|
||||
is(aApp.manifest.size, aExpectedApp.size, "Check size");
|
||||
}
|
||||
if (aApp.manifest) {
|
||||
is(aApp.manifest.launch_path, gSJSPath, "Check launch path");
|
||||
}
|
||||
if (aExpectedApp.manifestURL) {
|
||||
is(aApp.manifestURL, aExpectedApp.manifestURL, "Check manifestURL");
|
||||
}
|
||||
if (aExpectedApp.installOrigin) {
|
||||
is(aApp.installOrigin, aExpectedApp.installOrigin, "Check installOrigin");
|
||||
}
|
||||
ok(aApp.removable, "Removable app");
|
||||
if (typeof aExpectedApp.progress !== "undefined") {
|
||||
todo(aApp.progress == aExpectedApp.progress, "Check progress");
|
||||
}
|
||||
if (aExpectedApp.installState) {
|
||||
is(aApp.installState, aExpectedApp.installState, "Check installState");
|
||||
}
|
||||
if (typeof aExpectedApp.downloadAvailable !== "undefined") {
|
||||
is(aApp.downloadAvailable, aExpectedApp.downloadAvailable,
|
||||
"Check download available");
|
||||
}
|
||||
if (typeof aExpectedApp.downloading !== "undefined") {
|
||||
is(aApp.downloading, aExpectedApp.downloading, "Check downloading");
|
||||
}
|
||||
if (typeof aExpectedApp.downloadSize !== "undefined") {
|
||||
is(aApp.downloadSize, aExpectedApp.downloadSize, "Check downloadSize");
|
||||
}
|
||||
if (typeof aExpectedApp.readyToApplyDownload !== "undefined") {
|
||||
is(aApp.readyToApplyDownload, aExpectedApp.readyToApplyDownload,
|
||||
"Check readyToApplyDownload");
|
||||
}
|
||||
if (aLaunchable) {
|
||||
if (aUninstall) {
|
||||
checkUninstallApp(aApp);
|
||||
} else if (aCb && typeof aCb === 'function') {
|
||||
aCb();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if app is not launchable.
|
||||
var req = aApp.launch();
|
||||
req.onsuccess = function () {
|
||||
ok(false, "We shouldn't be here");
|
||||
finish();
|
||||
};
|
||||
req.onerror = function() {
|
||||
ok(true, "App is not launchable");
|
||||
if (aUninstall) {
|
||||
checkUninstallApp(aApp);
|
||||
} else if (aCb && typeof aCb === 'function') {
|
||||
aCb();
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var steps = [
|
||||
function() {
|
||||
// Set up
|
||||
launchableValue = SpecialPowers.setAllAppsLaunchable(true);
|
||||
SpecialPowers.addPermission("webapps-manage", true, document);
|
||||
ok(true, "Set up");
|
||||
next();
|
||||
},
|
||||
function() {
|
||||
ok(true, "autoConfirmAppInstall");
|
||||
SpecialPowers.autoConfirmAppInstall(next);
|
||||
},
|
||||
function() {
|
||||
setAppVersion(0, next);
|
||||
},
|
||||
function() {
|
||||
// Test network error.
|
||||
ok(true, "== TEST == Network error");
|
||||
checkAppInstallError("http://notvalidurl", "NETWORK_ERROR");
|
||||
},
|
||||
function() {
|
||||
// Test wrong mini-manifest content type.
|
||||
ok(true, "== TEST == Not valid mini-manifest content type");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&noManifestContentType=true";
|
||||
checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
|
||||
},
|
||||
function() {
|
||||
// Test mini-manifest 'size' value is not number. Bug 839435.
|
||||
ok(true, "== TEST == Size value is not a number");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&packageSize=\"NotANumber\"";
|
||||
checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
|
||||
},
|
||||
function() {
|
||||
// Test mini-manifest negative 'size' value. Bug 839435.
|
||||
ok(true, "== TEST == Negative size value");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&packageSize=-1";
|
||||
checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
|
||||
},
|
||||
function() {
|
||||
// Test wrong package path
|
||||
ok(true, "== TEST == Installing app with wrong package path");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&wrongPackagePath=true";
|
||||
checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
|
||||
},
|
||||
function() {
|
||||
// Test no manifest in zip file.
|
||||
ok(true, "== TEST == No manifest in the zip file");
|
||||
var miniManifestURL = gSJS + "?getManifest=true";
|
||||
checkAppDownloadError(miniManifestURL, "MISSING_MANIFEST", 0, true, true,
|
||||
gAppName);
|
||||
},
|
||||
function() {
|
||||
setAppVersion(1, next);
|
||||
},
|
||||
function() {
|
||||
// Test mini-manifest app name is different from the webapp manifest name.
|
||||
// Bug 844243.
|
||||
ok(true, "== TEST == Mini-manifest app name is different from webapp " +
|
||||
"manifest name");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&appName=arandomname";
|
||||
checkAppDownloadError(miniManifestURL, "MANIFEST_MISMATCH", 1, true, true,
|
||||
"arandomname");
|
||||
},
|
||||
function() {
|
||||
// Test mini-manifest dev name is different from the webapp manifest dev
|
||||
// name.
|
||||
ok (true, "== TEST == Mini-manifest dev name is different from manifest " +
|
||||
"dev name");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&devName=arandomdevname";
|
||||
checkAppDownloadError(miniManifestURL, "MANIFEST_MISMATCH", 1, true, true,
|
||||
gAppName);
|
||||
},
|
||||
function() {
|
||||
// Test mini-manifest dev url is different from the webapp manifest dev
|
||||
// url.
|
||||
ok (true, "== TEST == Mini-manifest dev url is different from manifest " +
|
||||
"dev url");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true" +
|
||||
"&devUrl=arandomdevurl";
|
||||
checkAppDownloadError(miniManifestURL, "MANIFEST_MISMATCH", 1, true, true,
|
||||
gAppName);
|
||||
},
|
||||
function() {
|
||||
setAppVersion(2, next);
|
||||
},
|
||||
function() {
|
||||
ok(true, "== TEST == Install packaged app");
|
||||
var miniManifestURL = gSJS +
|
||||
"?getManifest=true";
|
||||
navigator.mozApps.mgmt.oninstall = function(evt) {
|
||||
ok(true, "Got oninstall event");
|
||||
gApp = evt.application;
|
||||
gApp.ondownloaderror = function() {
|
||||
ok(false, "Download error " + gApp.downloadError.name);
|
||||
finish();
|
||||
};
|
||||
gApp.ondownloadsuccess = function() {
|
||||
ok(true, "App downloaded");
|
||||
var expected = {
|
||||
name: gAppName,
|
||||
manifestURL: miniManifestURL,
|
||||
installOrigin: gInstallOrigin,
|
||||
progress: 0,
|
||||
installState: "installed",
|
||||
downloadAvailable: false,
|
||||
downloading: false,
|
||||
downloadSize: 0,
|
||||
size: 0,
|
||||
readyToApplyDownload: false,
|
||||
};
|
||||
checkAppState(gApp, 2, expected, true, false, next);
|
||||
};
|
||||
};
|
||||
|
||||
var request = navigator.mozApps.installPackage(miniManifestURL);
|
||||
request.onerror = function(evt) {
|
||||
cbError(evt.target.error.name);
|
||||
};
|
||||
request.onsuccess = function() {
|
||||
ok(true, "Application installed");
|
||||
};
|
||||
},
|
||||
function() {
|
||||
ok(true, "all done!\n");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
];
|
||||
|
||||
addLoadEvent(go);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -333,10 +333,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
|
|||
#include "TimeManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
#include "nsIDOMDataChannel.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -565,8 +561,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(ClipboardEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(KeyboardEvent, nsEventSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CompositionEvent, nsEventSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
|
@ -906,11 +900,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(MozTimeManager, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
NS_DEFINE_CLASSINFO_DATA(DataChannel, nsEventTargetSH,
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NS_DEFINE_CONTRACT_CTOR(_class, _contract_id) \
|
||||
|
@ -1713,11 +1702,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(KeyboardEvent, nsIDOMKeyEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CompositionEvent, nsIDOMCompositionEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCompositionEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
|
@ -2285,13 +2269,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
DOM_CLASSINFO_MAP_BEGIN(DataChannel, nsIDOMDataChannel)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDataChannel)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
|
||||
"The number of items in sClassInfoData doesn't match the "
|
||||
"number of nsIDOMClassInfo ID's, this is bad! Fix it!");
|
||||
|
@ -2672,8 +2649,8 @@ nsDOMClassInfo::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
nsresult rv;
|
||||
JS::Rooted<JSObject*> real_obj(cx);
|
||||
if (wrapper) {
|
||||
rv = wrapper->GetJSObject(real_obj.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
real_obj = wrapper->GetJSObject();
|
||||
NS_ENSURE_STATE(real_obj);
|
||||
}
|
||||
else {
|
||||
real_obj = obj;
|
||||
|
@ -3383,8 +3360,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
|||
} else {
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(native);
|
||||
|
||||
JS::Rooted<JSObject*> thisObject(cx);
|
||||
wrappedJS->GetJSObject(thisObject.address());
|
||||
JS::Rooted<JSObject*> thisObject(cx, wrappedJS->GetJSObject());
|
||||
if (!thisObject) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -4129,8 +4105,7 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
|
|||
aProto);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> proto_obj(cx);
|
||||
(*aProto)->GetJSObject(proto_obj.address());
|
||||
JS::Rooted<JSObject*> proto_obj(cx, (*aProto)->GetJSObject());
|
||||
if (!JS_WrapObject(cx, proto_obj.address())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -4172,8 +4147,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> class_obj(cx);
|
||||
holder->GetJSObject(class_obj.address());
|
||||
JS::Rooted<JSObject*> class_obj(cx, holder->GetJSObject());
|
||||
NS_ASSERTION(class_obj, "The return value lied");
|
||||
|
||||
const nsIID *primary_iid = &NS_GET_IID(nsISupports);
|
||||
|
@ -4450,8 +4424,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
rv = constructor->Install(cx, obj, v);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> class_obj(cx);
|
||||
holder->GetJSObject(class_obj.address());
|
||||
JS::Rooted<JSObject*> class_obj(cx, holder->GetJSObject());
|
||||
NS_ASSERTION(class_obj, "The return value lied");
|
||||
|
||||
// ... and define the constants from the DOM interface on that
|
||||
|
@ -4479,9 +4452,8 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
getter_AddRefs(proto_holder));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && obj != aWin->GetGlobalJSObject()) {
|
||||
JS::Rooted<JSObject*> dot_prototype(cx);
|
||||
rv = proto_holder->GetJSObject(dot_prototype.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::Rooted<JSObject*> dot_prototype(cx, proto_holder->GetJSObject());
|
||||
NS_ENSURE_STATE(dot_prototype);
|
||||
|
||||
const nsDOMClassInfoData *ci_data;
|
||||
if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
|
@ -4521,9 +4493,8 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
getter_AddRefs(proto_holder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject* dot_prototype;
|
||||
rv = proto_holder->GetJSObject(&dot_prototype);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JSObject* dot_prototype = proto_holder->GetJSObject();
|
||||
NS_ENSURE_STATE(dot_prototype);
|
||||
|
||||
const nsDOMClassInfoData *ci_data;
|
||||
if (alias_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
|
@ -4555,9 +4526,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
rv = constructor->Install(cx, obj, val);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject* class_obj;
|
||||
holder->GetJSObject(&class_obj);
|
||||
NS_ASSERTION(class_obj, "Why didn't we get a JSObject?");
|
||||
NS_ASSERTION(holder->GetJSObject(), "Why didn't we get a JSObject?");
|
||||
|
||||
*did_resolve = true;
|
||||
|
||||
|
@ -4902,8 +4871,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Make sure we wrap the location object in the window's scope.
|
||||
JS::Rooted<JSObject*> scope(cx);
|
||||
wrapper->GetJSObject(scope.address());
|
||||
JS::Rooted<JSObject*> scope(cx, wrapper->GetJSObject());
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
|
@ -5086,8 +5054,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
// defined on our prototype chain. This way we can access this
|
||||
// expando w/o ever getting back into XPConnect.
|
||||
if (flags & JSRESOLVE_ASSIGNING) {
|
||||
JS::Rooted<JSObject*> realObj(cx);
|
||||
wrapper->GetJSObject(realObj.address());
|
||||
JS::Rooted<JSObject*> realObj(cx, wrapper->GetJSObject());
|
||||
|
||||
if (obj == realObj) {
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
|
@ -5932,13 +5899,7 @@ nsNamedArraySH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
!ObjectIsNativeWrapper(cx, obj)) {
|
||||
|
||||
{
|
||||
JS::Rooted<JSObject*> realObj(cx);
|
||||
|
||||
if (wrapper) {
|
||||
wrapper->GetJSObject(realObj.address());
|
||||
} else {
|
||||
realObj = obj;
|
||||
}
|
||||
JS::Rooted<JSObject*> realObj(cx, wrapper ? wrapper->GetJSObject() : obj);
|
||||
|
||||
JSAutoCompartment ac(cx, realObj);
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
|
@ -6928,8 +6889,7 @@ nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> realObj(cx);
|
||||
wrapper->GetJSObject(realObj.address());
|
||||
JS::Rooted<JSObject*> realObj(cx, wrapper->GetJSObject());
|
||||
|
||||
JSAutoCompartment ac(cx, realObj);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ DOMCI_CLASS(MouseScrollEvent)
|
|||
DOMCI_CLASS(WheelEvent)
|
||||
DOMCI_CLASS(DragEvent)
|
||||
DOMCI_CLASS(ClipboardEvent)
|
||||
DOMCI_CLASS(KeyboardEvent)
|
||||
DOMCI_CLASS(CompositionEvent)
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) DOMCI_CLASS(_event_interface)
|
||||
|
@ -240,5 +239,4 @@ DOMCI_CLASS(MozTimeManager)
|
|||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
DOMCI_CLASS(DataChannel)
|
||||
#endif
|
||||
|
|
|
@ -2130,7 +2130,7 @@ CreateNativeGlobalForInner(JSContext* aCx,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
MOZ_ASSERT(jsholder);
|
||||
jsholder->GetJSObject(aNativeGlobal);
|
||||
*aNativeGlobal = jsholder->GetJSObject();
|
||||
jsholder.forget(aHolder);
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
|
|
|
@ -231,6 +231,10 @@ DOMInterfaces = {
|
|||
'nativeType': 'nsDOMCSSValueList'
|
||||
},
|
||||
|
||||
'DataChannel': {
|
||||
'nativeType': 'nsDOMDataChannel',
|
||||
},
|
||||
|
||||
'DataContainerEvent': {
|
||||
'nativeType': 'nsDOMDataContainerEvent',
|
||||
},
|
||||
|
@ -564,6 +568,10 @@ DOMInterfaces = {
|
|||
'nativeType': 'nsDOMKeyboardEvent',
|
||||
},
|
||||
|
||||
'KeyEvent': {
|
||||
'concrete': False
|
||||
},
|
||||
|
||||
'LocalMediaStream': {
|
||||
'headerFile': 'DOMMediaStream.h',
|
||||
'nativeType': 'mozilla::DOMLocalMediaStream'
|
||||
|
|
|
@ -343,8 +343,8 @@ public:
|
|||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
if (NS_FAILED(wrappedJS->GetJSObject(obj.address())) || !obj) {
|
||||
JS::Rooted<JSObject*> obj(cx, wrappedJS->GetJSObject());
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -6057,7 +6057,7 @@ class ClassMethod(ClassItem):
|
|||
${className}::${name}(${args})${const}
|
||||
{
|
||||
${body}
|
||||
}\n
|
||||
}
|
||||
""").substitute({ 'templateClause': templateClause,
|
||||
'decorators': self.getDecorators(False),
|
||||
'returnType': self.returnType,
|
||||
|
@ -6096,7 +6096,7 @@ class ClassConstructor(ClassItem):
|
|||
self.inline = inline or bodyInHeader
|
||||
self.bodyInHeader = bodyInHeader
|
||||
self.explicit = explicit
|
||||
self.baseConstructors = baseConstructors
|
||||
self.baseConstructors = baseConstructors or []
|
||||
self.body = body
|
||||
ClassItem.__init__(self, None, visibility)
|
||||
|
||||
|
@ -6114,7 +6114,7 @@ class ClassConstructor(ClassItem):
|
|||
items = [str(c) for c in self.baseConstructors]
|
||||
for m in cgClass.members:
|
||||
if not m.static:
|
||||
initialize = m.getBody()
|
||||
initialize = m.body
|
||||
if initialize:
|
||||
items.append(m.name + "(" + initialize + ")")
|
||||
|
||||
|
@ -6155,7 +6155,7 @@ class ClassConstructor(ClassItem):
|
|||
|
||||
return string.Template("""${decorators}
|
||||
${className}::${className}(${args})${initializationList}
|
||||
{${body}}\n
|
||||
{${body}}
|
||||
""").substitute({ 'decorators': self.getDecorators(False),
|
||||
'className': cgClass.getNameString(),
|
||||
'args': args,
|
||||
|
@ -6225,7 +6225,7 @@ class ClassDestructor(ClassItem):
|
|||
|
||||
return string.Template("""${decorators}
|
||||
${className}::~${className}()
|
||||
{${body}}\n
|
||||
{${body}}
|
||||
""").substitute({ 'decorators': self.getDecorators(False),
|
||||
'className': cgClass.getNameString(),
|
||||
'body': body })
|
||||
|
@ -6289,7 +6289,8 @@ class CGClass(CGThing):
|
|||
def __init__(self, name, bases=[], members=[], constructors=[],
|
||||
destructor=None, methods=[],
|
||||
typedefs = [], enums=[], templateArgs=[],
|
||||
templateSpecialization=[], isStruct=False, indent='',
|
||||
templateSpecialization=[], isStruct=False,
|
||||
disallowCopyConstruction=False, indent='',
|
||||
decorators='',
|
||||
extradeclarations='',
|
||||
extradefinitions=''):
|
||||
|
@ -6307,6 +6308,7 @@ class CGClass(CGThing):
|
|||
self.templateArgs = templateArgs
|
||||
self.templateSpecialization = templateSpecialization
|
||||
self.isStruct = isStruct
|
||||
self.disallowCopyConstruction = disallowCopyConstruction
|
||||
self.indent = indent
|
||||
self.defaultVisibility ='public' if isStruct else 'private'
|
||||
self.decorators = decorators
|
||||
|
@ -6392,9 +6394,20 @@ class CGClass(CGThing):
|
|||
lastVisibility = visibility
|
||||
return (result, lastVisibility, itemCount)
|
||||
|
||||
if self.disallowCopyConstruction:
|
||||
class DisallowedCopyConstructor(object):
|
||||
def __init__(self):
|
||||
self.visibility = "private"
|
||||
def declare(self, cgClass):
|
||||
name = cgClass.getNameString()
|
||||
return "%s(const %s&) MOZ_DELETE;\n" % (name, name)
|
||||
disallowedCopyConstructors = [DisallowedCopyConstructor()]
|
||||
else:
|
||||
disallowedCopyConstructors = []
|
||||
|
||||
order = [(self.enums, ''), (self.typedefs, ''), (self.members, ''),
|
||||
(self.constructors, '\n'), (self.destructors, '\n'),
|
||||
(self.methods, '\n')]
|
||||
(self.constructors + disallowedCopyConstructors, '\n'),
|
||||
(self.destructors, '\n'), (self.methods, '\n')]
|
||||
|
||||
lastVisibility = self.defaultVisibility
|
||||
itemCount = 0
|
||||
|
@ -6416,11 +6429,14 @@ class CGClass(CGThing):
|
|||
for member in memberList:
|
||||
if itemCount != 0:
|
||||
result = result + separator
|
||||
result = result + member.define(cgClass)
|
||||
itemCount = itemCount + 1
|
||||
definition = member.define(cgClass)
|
||||
if definition:
|
||||
# Member variables would only produce empty lines here.
|
||||
result += definition
|
||||
itemCount += 1
|
||||
return (result, itemCount)
|
||||
|
||||
order = [(self.members, '\n'), (self.constructors, '\n'),
|
||||
order = [(self.members, ''), (self.constructors, '\n'),
|
||||
(self.destructors, '\n'), (self.methods, '\n')]
|
||||
|
||||
result = self.extradefinitions
|
||||
|
@ -7492,6 +7508,7 @@ class CGDictionary(CGThing):
|
|||
self.dictionary = dictionary
|
||||
self.descriptorProvider = descriptorProvider
|
||||
self.workers = descriptorProvider.workers
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
self.needToInitIds = not self.workers and len(dictionary.members) > 0
|
||||
self.memberInfo = [
|
||||
(member,
|
||||
|
@ -7501,169 +7518,194 @@ class CGDictionary(CGThing):
|
|||
isOptional=(not member.defaultValue),
|
||||
defaultValue=member.defaultValue))
|
||||
for member in dictionary.members ]
|
||||
self.structs = self.getStructs()
|
||||
|
||||
def declare(self):
|
||||
d = self.dictionary
|
||||
if d.parent:
|
||||
inheritance = "%s" % self.makeClassName(d.parent)
|
||||
elif not self.workers:
|
||||
inheritance = "MainThreadDictionaryBase"
|
||||
else:
|
||||
inheritance = "DictionaryBase"
|
||||
memberDecls = [" %s %s;" %
|
||||
(self.getMemberType(m),
|
||||
self.makeMemberName(m[0].identifier.name))
|
||||
for m in self.memberInfo]
|
||||
|
||||
return (string.Template(
|
||||
"struct ${selfName} : public ${inheritance} {\n"
|
||||
" ${selfName}() {}\n"
|
||||
" bool Init(JSContext* cx, JS::Handle<JS::Value> val);\n" +
|
||||
(" bool Init(const nsAString& aJSON);\n" if not self.workers else "") +
|
||||
" bool ToObject(JSContext* cx, JS::Handle<JSObject*> parentObject, JS::Value *vp) const;\n"
|
||||
" void TraceDictionary(JSTracer* trc);\n"
|
||||
"\n" +
|
||||
"\n".join(memberDecls) + "\n"
|
||||
"private:\n"
|
||||
" // Disallow copy-construction\n"
|
||||
" ${selfName}(const ${selfName}&) MOZ_DELETE;\n" +
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
(" static bool InitIds(JSContext* cx);\n"
|
||||
" static bool initedIds;\n" if self.needToInitIds else "") +
|
||||
"\n".join(" static jsid " +
|
||||
self.makeIdName(m.identifier.name) + ";" for
|
||||
m in d.members) + "\n"
|
||||
"};\n"
|
||||
"struct ${selfName}Initializer : public ${selfName} {\n"
|
||||
" ${selfName}Initializer() {\n"
|
||||
" // Safe to pass a null context if we pass a null value\n"
|
||||
" Init(nullptr, JS::NullHandleValue);\n"
|
||||
" }\n"
|
||||
"};").substitute( { "selfName": self.makeClassName(d),
|
||||
"inheritance": inheritance }))
|
||||
return self.structs.declare()
|
||||
|
||||
def define(self):
|
||||
d = self.dictionary
|
||||
if d.parent:
|
||||
initParent = ("// Per spec, we init the parent's members first\n"
|
||||
"if (!%s::Init(cx, val)) {\n"
|
||||
" return false;\n"
|
||||
"}\n" % self.makeClassName(d.parent))
|
||||
toObjectParent = ("// Per spec, we define the parent's members first\n"
|
||||
"if (!%s::ToObject(cx, parentObject, vp)) {\n"
|
||||
" return false;\n"
|
||||
"}\n" % self.makeClassName(d.parent))
|
||||
ensureObject = "JS::Rooted<JSObject*> obj(cx, &vp->toObject());\n"
|
||||
traceParent = ("%s::TraceDictionary(trc);\n" %
|
||||
self.makeClassName(d.parent))
|
||||
else:
|
||||
initParent = ""
|
||||
toObjectParent = ""
|
||||
ensureObject = ("JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));\n"
|
||||
"if (!obj) {\n"
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
"*vp = JS::ObjectValue(*obj);\n")
|
||||
traceParent = ""
|
||||
return self.structs.define()
|
||||
|
||||
memberInits = [CGIndenter(self.getMemberConversion(m)).define()
|
||||
def base(self):
|
||||
if self.dictionary.parent:
|
||||
return self.makeClassName(self.dictionary.parent)
|
||||
if not self.workers:
|
||||
return "MainThreadDictionaryBase"
|
||||
return "DictionaryBase"
|
||||
|
||||
def initMethod(self):
|
||||
body = (
|
||||
"// Passing a null JSContext is OK only if we're initing from null,\n"
|
||||
"// Since in that case we will not have to do any property gets\n"
|
||||
"MOZ_ASSERT_IF(!cx, val.isNull());\n")
|
||||
|
||||
if self.needToInitIds:
|
||||
body += (
|
||||
"if (cx && !initedIds && !InitIds(cx)) {\n"
|
||||
" return false;\n"
|
||||
"}\n")
|
||||
|
||||
if self.dictionary.parent:
|
||||
body += (
|
||||
"// Per spec, we init the parent's members first\n"
|
||||
"if (!%s::Init(cx, val)) {\n"
|
||||
" return false;\n"
|
||||
"}\n") % self.makeClassName(self.dictionary.parent)
|
||||
|
||||
memberInits = [self.getMemberConversion(m).define()
|
||||
for m in self.memberInfo]
|
||||
if memberInits:
|
||||
body += (
|
||||
"JSBool found;\n"
|
||||
"JS::Rooted<JS::Value> temp(cx);\n"
|
||||
"bool isNull = val.isNullOrUndefined();\n")
|
||||
|
||||
body += (
|
||||
"if (!IsConvertibleToDictionary(cx, val)) {\n"
|
||||
" return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY);\n"
|
||||
"}\n"
|
||||
"\n")
|
||||
|
||||
if memberInits:
|
||||
body += "\n\n".join(memberInits) + "\n"
|
||||
|
||||
body += "return true;"
|
||||
|
||||
return ClassMethod("Init", "bool", [
|
||||
Argument('JSContext*', 'cx'),
|
||||
Argument('JS::Handle<JS::Value>', 'val'),
|
||||
], body=body)
|
||||
|
||||
def initFromJSONMethod(self):
|
||||
assert not self.workers
|
||||
return ClassMethod("Init", "bool", [
|
||||
Argument('const nsAString&', 'aJSON'),
|
||||
], body=(
|
||||
"AutoSafeJSContext cx;\n"
|
||||
"JSAutoRequest ar(cx);\n"
|
||||
"JS::Rooted<JS::Value> json(cx);\n"
|
||||
"bool ok = ParseJSON(cx, aJSON, &json);\n"
|
||||
"NS_ENSURE_TRUE(ok, false);\n"
|
||||
"return Init(cx, json);"
|
||||
))
|
||||
|
||||
def toObjectMethod(self):
|
||||
body = ""
|
||||
if self.needToInitIds:
|
||||
body += (
|
||||
"if (!initedIds && !InitIds(cx)) {\n"
|
||||
" return false;\n"
|
||||
"}\n")
|
||||
|
||||
if self.dictionary.parent:
|
||||
body += (
|
||||
"// Per spec, we define the parent's members first\n"
|
||||
"if (!%s::ToObject(cx, parentObject, vp)) {\n"
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
"JS::Rooted<JSObject*> obj(cx, &vp->toObject());\n"
|
||||
"\n") % self.makeClassName(self.dictionary.parent)
|
||||
else:
|
||||
body += (
|
||||
"JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));\n"
|
||||
"if (!obj) {\n"
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
"*vp = JS::ObjectValue(*obj);\n"
|
||||
"\n")
|
||||
|
||||
body += "\n\n".join(self.getMemberDefinition(m).define()
|
||||
for m in self.memberInfo)
|
||||
body += "\n\nreturn true;"
|
||||
|
||||
return ClassMethod("ToObject", "bool", [
|
||||
Argument('JSContext*', 'cx'),
|
||||
Argument('JS::Handle<JSObject*>', 'parentObject'),
|
||||
Argument('JS::Value*', 'vp'),
|
||||
], const=True, body=body)
|
||||
|
||||
def initIdsMethod(self):
|
||||
assert self.needToInitIds
|
||||
idinit = [CGGeneric('!InternJSString(cx, %s, "%s")' %
|
||||
(m.identifier.name + "_id", m.identifier.name))
|
||||
for m in d.members]
|
||||
for m in self.dictionary.members]
|
||||
idinit = CGList(idinit, " ||\n")
|
||||
idinit = CGWrapper(idinit, pre="if (",
|
||||
post=(") {\n"
|
||||
" return false;\n"
|
||||
"}"),
|
||||
reindent=True)
|
||||
memberDefines = [CGIndenter(self.getMemberDefinition(m)).define()
|
||||
for m in self.memberInfo]
|
||||
memberTraces = [CGIndenter(self.getMemberTrace(m)).define()
|
||||
body = (
|
||||
"MOZ_ASSERT(!initedIds);\n"
|
||||
"%s\n"
|
||||
"initedIds = true;\n"
|
||||
"return true;") % idinit.define()
|
||||
|
||||
return ClassMethod("InitIds", "bool", [
|
||||
Argument("JSContext*", "cx"),
|
||||
], static=True, body=body, visibility="private")
|
||||
|
||||
def traceDictionaryMethod(self):
|
||||
body = ""
|
||||
if self.dictionary.parent:
|
||||
cls = self.makeClassName(self.dictionary.parent)
|
||||
body += "%s::TraceDictionary(trc);\n" % cls
|
||||
|
||||
memberTraces = [self.getMemberTrace(m)
|
||||
for m in self.dictionary.members
|
||||
if typeNeedsCx(m.type, self.descriptorProvider)]
|
||||
|
||||
return string.Template(
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
("bool ${selfName}::initedIds = false;\n" +
|
||||
"\n".join("jsid ${selfName}::%s = JSID_VOID;" %
|
||||
self.makeIdName(m.identifier.name)
|
||||
for m in d.members) + "\n"
|
||||
"\n"
|
||||
"bool\n"
|
||||
"${selfName}::InitIds(JSContext* cx)\n"
|
||||
"{\n"
|
||||
" MOZ_ASSERT(!initedIds);\n"
|
||||
"${idInit}\n"
|
||||
" initedIds = true;\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"\n" if self.needToInitIds else "") +
|
||||
"bool\n"
|
||||
"${selfName}::Init(JSContext* cx, JS::Handle<JS::Value> val)\n"
|
||||
"{\n"
|
||||
" // Passing a null JSContext is OK only if we're initing from null,\n"
|
||||
" // Since in that case we will not have to do any property gets\n"
|
||||
" MOZ_ASSERT_IF(!cx, val.isNull());\n" +
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
(" if (cx && !initedIds && !InitIds(cx)) {\n"
|
||||
" return false;\n"
|
||||
" }\n" if self.needToInitIds else "") +
|
||||
"${initParent}" +
|
||||
(" JSBool found;\n"
|
||||
" JS::Rooted<JS::Value> temp(cx);\n"
|
||||
" bool isNull = val.isNullOrUndefined();\n" if len(memberInits) > 0 else "") +
|
||||
" if (!IsConvertibleToDictionary(cx, val)) {\n"
|
||||
" return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"${initMembers}\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"\n" +
|
||||
("bool\n"
|
||||
"${selfName}::Init(const nsAString& aJSON)\n"
|
||||
"{\n"
|
||||
" AutoSafeJSContext cx;\n"
|
||||
" JSAutoRequest ar(cx);\n"
|
||||
" JS::Rooted<JS::Value> json(cx);\n"
|
||||
" bool ok = ParseJSON(cx, aJSON, &json);\n"
|
||||
" NS_ENSURE_TRUE(ok, false);\n"
|
||||
" return Init(cx, json);\n"
|
||||
"}\n" if not self.workers else "") +
|
||||
"\n"
|
||||
"bool\n"
|
||||
"${selfName}::ToObject(JSContext* cx, JS::Handle<JSObject*> parentObject, JS::Value *vp) const\n"
|
||||
"{\n" +
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
(" if (!initedIds && !InitIds(cx)) {\n"
|
||||
" return false;\n"
|
||||
" }\n" if self.needToInitIds else "") +
|
||||
"${toObjectParent}"
|
||||
"${ensureObject}"
|
||||
"\n"
|
||||
"${defineMembers}\n"
|
||||
"\n"
|
||||
" return true;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void\n"
|
||||
"${selfName}::TraceDictionary(JSTracer* trc)\n"
|
||||
"{\n"
|
||||
"${traceParent}"
|
||||
"${traceMembers}\n"
|
||||
"}").substitute({
|
||||
"selfName": self.makeClassName(d),
|
||||
"initParent": CGIndenter(CGGeneric(initParent)).define(),
|
||||
"initMembers": "\n\n".join(memberInits),
|
||||
"idInit": CGIndenter(idinit).define(),
|
||||
"isMainThread": toStringBool(not self.workers),
|
||||
"toObjectParent": CGIndenter(CGGeneric(toObjectParent)).define(),
|
||||
"ensureObject": CGIndenter(CGGeneric(ensureObject)).define(),
|
||||
"traceMembers": "\n\n".join(memberTraces),
|
||||
"traceParent": CGIndenter(CGGeneric(traceParent)).define(),
|
||||
"defineMembers": "\n\n".join(memberDefines)
|
||||
})
|
||||
body += "\n\n".join(memberTraces)
|
||||
|
||||
return ClassMethod("TraceDictionary", "void", [
|
||||
Argument("JSTracer*", "trc"),
|
||||
], body=body)
|
||||
|
||||
def getStructs(self):
|
||||
d = self.dictionary
|
||||
selfName = self.makeClassName(d)
|
||||
members = [ClassMember(self.makeMemberName(m[0].identifier.name),
|
||||
self.getMemberType(m),
|
||||
visibility="public") for m in self.memberInfo]
|
||||
ctor = ClassConstructor([], bodyInHeader=True, visibility="public")
|
||||
methods = []
|
||||
|
||||
if self.needToInitIds:
|
||||
methods.append(self.initIdsMethod())
|
||||
members.append(ClassMember("initedIds", "bool", static=True, body="false"))
|
||||
members.extend(
|
||||
ClassMember(self.makeIdName(m.identifier.name), "jsid", static=True, body="JSID_VOID")
|
||||
for m in d.members)
|
||||
|
||||
methods.append(self.initMethod())
|
||||
|
||||
if not self.workers:
|
||||
methods.append(self.initFromJSONMethod())
|
||||
|
||||
methods.append(self.toObjectMethod())
|
||||
methods.append(self.traceDictionaryMethod())
|
||||
|
||||
struct = CGClass(selfName,
|
||||
bases=[ClassBase(self.base())],
|
||||
members=members,
|
||||
constructors=[ctor],
|
||||
methods=methods,
|
||||
isStruct=True,
|
||||
disallowCopyConstruction=True)
|
||||
|
||||
|
||||
initializerCtor = ClassConstructor([],
|
||||
bodyInHeader=True,
|
||||
visibility="public",
|
||||
body=(
|
||||
"// Safe to pass a null context if we pass a null value\n"
|
||||
"Init(nullptr, JS::NullHandleValue);"))
|
||||
initializerStruct = CGClass(selfName + "Initializer",
|
||||
bases=[ClassBase(selfName)],
|
||||
constructors=[initializerCtor],
|
||||
isStruct=True)
|
||||
|
||||
return CGList([struct, initializerStruct])
|
||||
|
||||
def deps(self):
|
||||
return self.dictionary.getDeps()
|
||||
|
@ -7843,7 +7885,7 @@ class CGDictionary(CGThing):
|
|||
if not member.defaultValue:
|
||||
trace = CGIfWrapper(trace, "%s.WasPassed()" % memberLoc)
|
||||
|
||||
return trace
|
||||
return trace.define()
|
||||
|
||||
@staticmethod
|
||||
def makeIdName(name):
|
||||
|
@ -8955,7 +8997,8 @@ def genConstructorBody(descriptor, initCall=""):
|
|||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
if (NS_FAILED(implWrapped->GetJSObject(jsImplObj.address()))) {
|
||||
jsImplObj = implWrapped->GetJSObject();
|
||||
if (!jsImplObj) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "nsIOutputStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#define TARGET_SUBDIR "downloads/bluetooth/"
|
||||
#define TARGET_SUBDIR "Download/Bluetooth/"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -751,7 +751,7 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
void
|
||||
BluetoothService::Notify(const BluetoothSignal& aData)
|
||||
{
|
||||
nsString type;
|
||||
nsString type = NS_LITERAL_STRING("bluetooth-pairing-request");
|
||||
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
|
@ -772,17 +772,14 @@ BluetoothService::Notify(const BluetoothSignal& aData)
|
|||
BT_LOG("[S] %s: %s", __FUNCTION__, NS_ConvertUTF16toUTF8(aData.name()).get());
|
||||
|
||||
if (aData.name().EqualsLiteral("RequestConfirmation")) {
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 3,
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 4,
|
||||
"RequestConfirmation: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestconfirmation");
|
||||
} else if (aData.name().EqualsLiteral("RequestPinCode")) {
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 2,
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 3,
|
||||
"RequestPinCode: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestpincode");
|
||||
} else if (aData.name().EqualsLiteral("RequestPasskey")) {
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 2,
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 3,
|
||||
"RequestPinCode: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestpasskey");
|
||||
} else if (aData.name().EqualsLiteral("Authorize")) {
|
||||
NS_ASSERTION(aData.value().get_ArrayOfBluetoothNamedValue().Length() == 2,
|
||||
"Authorize: Wrong length of parameters");
|
||||
|
@ -796,12 +793,11 @@ BluetoothService::Notify(const BluetoothSignal& aData)
|
|||
"PairedStatusChagned: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-pairedstatuschanged");
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
nsCString warningMsg;
|
||||
warningMsg.AssignLiteral("Not handling service signal: ");
|
||||
warningMsg.Append(NS_ConvertUTF16toUTF8(aData.name()));
|
||||
NS_WARNING(warningMsg.get());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISystemMessagesInternal> systemMessenger =
|
||||
|
|
|
@ -519,6 +519,9 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
|||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("path"),
|
||||
NS_ConvertUTF8toUTF16(objectPath)));
|
||||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("method"),
|
||||
NS_LITERAL_STRING("confirmation")));
|
||||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("passkey"),
|
||||
passkey));
|
||||
|
@ -553,6 +556,9 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
|||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("path"),
|
||||
NS_ConvertUTF8toUTF16(objectPath)));
|
||||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("method"),
|
||||
NS_LITERAL_STRING("pincode")));
|
||||
|
||||
KeepDBusPairingMessage(GetAddressFromObjectPath(
|
||||
NS_ConvertUTF8toUTF16(objectPath)), msg);
|
||||
|
@ -584,6 +590,9 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
|||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("path"),
|
||||
NS_ConvertUTF8toUTF16(objectPath)));
|
||||
parameters.AppendElement(BluetoothNamedValue(
|
||||
NS_LITERAL_STRING("method"),
|
||||
NS_LITERAL_STRING("passkey")));
|
||||
|
||||
KeepDBusPairingMessage(GetAddressFromObjectPath(
|
||||
NS_ConvertUTF8toUTF16(objectPath)), msg);
|
||||
|
@ -1848,57 +1857,43 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
BluetoothValue v = mSignal.value();
|
||||
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue ||
|
||||
v.get_ArrayOfBluetoothNamedValue().Length() == 0) {
|
||||
NS_WARNING("Invalid value type for GetDeviceProperties() method");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
v.get_ArrayOfBluetoothNamedValue();
|
||||
NS_ASSERTION(arr[0].name().EqualsLiteral("path"),
|
||||
"failed to get object path");
|
||||
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString,
|
||||
"failed to get_nsString");
|
||||
mSignal.value().get_ArrayOfBluetoothNamedValue();
|
||||
nsString devicePath = arr[0].value().get_nsString();
|
||||
|
||||
BluetoothValue prop;
|
||||
if (!GetPropertiesInternal(devicePath, DBUS_DEVICE_IFACE, prop)) {
|
||||
NS_WARNING("Getting properties failed!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
InfallibleTArray<BluetoothNamedValue>& properties =
|
||||
prop.get_ArrayOfBluetoothNamedValue();
|
||||
bool rv = GetPropertiesInternal(devicePath, DBUS_DEVICE_IFACE, prop);
|
||||
NS_ENSURE_TRUE(rv, NS_ERROR_FAILURE);
|
||||
|
||||
// Return original dbus message parameters and also device name
|
||||
// for agent events "RequestConfirmation", "RequestPinCode",
|
||||
// and "RequestPasskey"
|
||||
InfallibleTArray<BluetoothNamedValue>& parameters =
|
||||
v.get_ArrayOfBluetoothNamedValue();
|
||||
mSignal.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
// Replace object path with device address
|
||||
nsString address = GetAddressFromObjectPath(devicePath);
|
||||
parameters[0].name().AssignLiteral("address");
|
||||
parameters[0].value() = address;
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue>& properties =
|
||||
prop.get_ArrayOfBluetoothNamedValue();
|
||||
uint8_t i;
|
||||
for (i = 0; i < properties.Length(); i++) {
|
||||
// Append device name
|
||||
if (properties[i].name().EqualsLiteral("Name")) {
|
||||
properties[i].name().AssignLiteral("name");
|
||||
parameters.AppendElement(properties[i]);
|
||||
mSignal.value() = parameters;
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(i != properties.Length(), "failed to get device name");
|
||||
MOZ_ASSERT(i != properties.Length(), "failed to get device name");
|
||||
|
||||
nsRefPtr<DistributeBluetoothSignalTask> t =
|
||||
new DistributeBluetoothSignalTask(mSignal);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(t))) {
|
||||
NS_WARNING("Failed to dispatch to main thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_WARNING("Failed to dispatch to main thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1988,13 +1983,30 @@ private:
|
|||
nsresult
|
||||
BluetoothDBusService::GetDevicePropertiesInternal(const BluetoothSignal& aSignal)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called from main thread!");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mConnection || !gThreadConnection) {
|
||||
NS_ERROR("Bluetooth service not started yet!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
BluetoothValue v = aSignal.value();
|
||||
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue ||
|
||||
v.get_ArrayOfBluetoothNamedValue().Length() == 0) {
|
||||
NS_WARNING("Invalid value type for GetDevicePropertiesInternal() method");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
v.get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
// Device object path should be put in the first element
|
||||
if (!arr[0].name().EqualsLiteral("path") ||
|
||||
arr[0].value().type() != BluetoothValue::TnsString) {
|
||||
NS_WARNING("Invalid object path for GetDevicePropertiesInternal() method");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsRunnable> func(new BluetoothDevicePropertiesRunnable(aSignal));
|
||||
if (NS_FAILED(mBluetoothCommandThread->Dispatch(func, NS_DISPATCH_NORMAL))) {
|
||||
NS_WARNING("Cannot dispatch task!");
|
||||
|
|
|
@ -218,9 +218,8 @@ IDBFactory::Create(ContentParent* aContentParent,
|
|||
nsresult rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> global(cx);
|
||||
rv = globalHolder->GetJSObject(global.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::Rooted<JSObject*> global(cx, globalHolder->GetJSObject());
|
||||
NS_ENSURE_STATE(global);
|
||||
|
||||
// The CreateSandbox call returns a proxy to the actual sandbox object. We
|
||||
// don't need a proxy here.
|
||||
|
|
|
@ -52,8 +52,8 @@ ReturnKeyRange(JSContext* aCx,
|
|||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> result(aCx);
|
||||
if (NS_FAILED(holder->GetJSObject(result.address()))) {
|
||||
JS::Rooted<JSObject*> result(aCx, holder->GetJSObject());
|
||||
if (!result) {
|
||||
JS_ReportError(aCx, "Couldn't get JSObject from wrapper.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
interface nsIDOMDOMRequest;
|
||||
|
||||
[scriptable, uuid(d33ee8a0-00e4-4669-b55d-f77fbee1153d)]
|
||||
[scriptable, uuid(8bdeef38-e9cd-46f8-b8de-ed9e6b4d01ea)]
|
||||
interface mozIDOMApplication : nsISupports
|
||||
{
|
||||
readonly attribute jsval manifest;
|
||||
|
@ -85,8 +85,11 @@ interface mozIDOMApplication : nsISupports
|
|||
/* startPoint will be used when several launch_path exists for an app */
|
||||
nsIDOMDOMRequest launch([optional] in DOMString startPoint);
|
||||
|
||||
/* Clear data that has been collected through mozbrowser elements. */
|
||||
void clearBrowserData();
|
||||
/**
|
||||
* Clear data that has been collected through mozbrowser elements.
|
||||
* onsuccess will be called once data is actually cleared.
|
||||
*/
|
||||
nsIDOMDOMRequest clearBrowserData();
|
||||
};
|
||||
|
||||
[scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
|
||||
|
|
|
@ -1026,7 +1026,7 @@ ContentChild::RecvAsyncMessage(const nsString& aMsg,
|
|||
if (cpm) {
|
||||
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
|
||||
cpm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(cpm.get()),
|
||||
aMsg, false, &cloneData, nullptr, nullptr);
|
||||
aMsg, false, &cloneData, JS::NullPtr(), nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -866,7 +866,7 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
if (ppm) {
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
CHILD_PROCESS_SHUTDOWN_MESSAGE, false,
|
||||
nullptr, nullptr, nullptr);
|
||||
nullptr, JS::NullPtr(), nullptr);
|
||||
}
|
||||
nsCOMPtr<nsIThreadObserver>
|
||||
kungFuDeathGrip(static_cast<nsIThreadObserver*>(this));
|
||||
|
@ -2331,7 +2331,7 @@ ContentParent::RecvSyncMessage(const nsString& aMsg,
|
|||
if (ppm) {
|
||||
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
aMsg, true, &cloneData, nullptr, aRetvals);
|
||||
aMsg, true, &cloneData, JS::NullPtr(), aRetvals);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2344,7 +2344,7 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg,
|
|||
if (ppm) {
|
||||
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
aMsg, false, &cloneData, nullptr, nullptr);
|
||||
aMsg, false, &cloneData, JS::NullPtr(), nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1436,7 +1436,7 @@ TabChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
|
|||
nsRefPtr<nsFrameMessageManager> mm =
|
||||
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
|
||||
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal),
|
||||
aMessageName, false, &cloneData, nullptr, nullptr);
|
||||
aMessageName, false, &cloneData, JS::NullPtr(), nullptr);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1974,7 +1974,7 @@ TabChild::RecvAsyncMessage(const nsString& aMessage,
|
|||
nsRefPtr<nsFrameMessageManager> mm =
|
||||
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
|
||||
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal),
|
||||
aMessage, false, &cloneData, nullptr, nullptr);
|
||||
aMessage, false, &cloneData, JS::NullPtr(), nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1102,7 +1102,7 @@ TabParent::ReceiveMessage(const nsString& aMessage,
|
|||
uint32_t len = 0; //TODO: obtain a real value in bug 572685
|
||||
// Because we want JS messages to have always the same properties,
|
||||
// create array even if len == 0.
|
||||
JSObject* objectsArray = JS_NewArrayObject(ctx, len, NULL);
|
||||
JS::Rooted<JSObject*> objectsArray(ctx, JS_NewArrayObject(ctx, len, NULL));
|
||||
if (!objectsArray) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ this.SystemMessagePermissionsTable = {
|
|||
"bluetooth-hfp-status-changed": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-pairing-request": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-opp-transfer-complete": {
|
||||
"bluetooth": []
|
||||
},
|
||||
|
|
|
@ -1245,8 +1245,7 @@ _getpluginelement(NPP npp)
|
|||
getter_AddRefs(holder));
|
||||
NS_ENSURE_TRUE(holder, nullptr);
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
holder->GetJSObject(obj.address());
|
||||
JS::Rooted<JSObject*> obj(cx, holder->GetJSObject());
|
||||
NS_ENSURE_TRUE(obj, nullptr);
|
||||
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
|
||||
|
|
|
@ -290,9 +290,8 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
|||
// our current compartment. Because our current context doesn't necessarily
|
||||
// subsume that of the sandbox, we want to unwrap and enter the sandbox's
|
||||
// compartment. It's a shame that the APIs here are so clunkly. :-(
|
||||
JS::Rooted<JSObject*> sandboxObj(cx);
|
||||
rv = sandbox->GetJSObject(sandboxObj.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::Rooted<JSObject*> sandboxObj(cx, sandbox->GetJSObject());
|
||||
NS_ENSURE_STATE(sandboxObj);
|
||||
sandboxObj = js::UncheckedUnwrap(sandboxObj);
|
||||
JSAutoCompartment ac(cx, sandboxObj);
|
||||
|
||||
|
|
|
@ -79,7 +79,11 @@ public:
|
|||
|
||||
int32_t phoneState = nsIAudioManager::PHONE_STATE_INVALID;
|
||||
am->GetPhoneState(&phoneState);
|
||||
#if ANDROID_VERSION < 17
|
||||
AudioSystem::setPhoneState(phoneState);
|
||||
#else
|
||||
AudioSystem::setPhoneState(static_cast<audio_mode_t>(phoneState));
|
||||
#endif
|
||||
|
||||
AudioSystem::get_audio_flinger();
|
||||
return NS_OK;
|
||||
|
@ -257,8 +261,16 @@ AudioManager::AudioManager() : mPhoneState(PHONE_STATE_CURRENT),
|
|||
mCurrentStreamVolumeTbl[loop] = sMaxStreamVolumeTbl[loop];
|
||||
}
|
||||
// Force publicnotification to output at maximal volume
|
||||
AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_ENFORCED_AUDIBLE),
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_ENFORCED_AUDIBLE]);
|
||||
#if ANDROID_VERSION < 17
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_ENFORCED_AUDIBLE),
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_ENFORCED_AUDIBLE]);
|
||||
#else
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_ENFORCED_AUDIBLE),
|
||||
sMaxStreamVolumeTbl[AUDIO_STREAM_ENFORCED_AUDIBLE],
|
||||
AUDIO_DEVICE_OUT_SPEAKER);
|
||||
#endif
|
||||
|
||||
AudioSystem::setErrorCallback(BinderDeadCallback);
|
||||
}
|
||||
|
@ -350,7 +362,11 @@ AudioManager::SetPhoneState(int32_t aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if ANDROID_VERSION < 17
|
||||
if (AudioSystem::setPhoneState(aState)) {
|
||||
#else
|
||||
if (AudioSystem::setPhoneState(static_cast<audio_mode_t>(aState))) {
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -451,8 +467,23 @@ AudioManager::SetFmRadioAudioEnabled(bool aFmRadioAudioEnabled)
|
|||
// sync volume with music after powering on fm radio
|
||||
if (aFmRadioAudioEnabled) {
|
||||
int32_t volIndex = 0;
|
||||
AudioSystem::getStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_MUSIC), &volIndex);
|
||||
AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_FM), volIndex);
|
||||
#if ANDROID_VERSION < 17
|
||||
AudioSystem::getStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_MUSIC),
|
||||
&volIndex);
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_FM),
|
||||
volIndex);
|
||||
#else
|
||||
AudioSystem::getStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_MUSIC),
|
||||
&volIndex,
|
||||
AUDIO_DEVICE_OUT_DEFAULT);
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_FM),
|
||||
volIndex,
|
||||
AUDIO_DEVICE_OUT_SPEAKER);
|
||||
#endif
|
||||
mCurrentStreamVolumeTbl[AUDIO_STREAM_FM] = volIndex;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -463,12 +494,31 @@ AudioManager::SetFmRadioAudioEnabled(bool aFmRadioAudioEnabled)
|
|||
|
||||
NS_IMETHODIMP
|
||||
AudioManager::SetStreamVolumeIndex(int32_t aStream, int32_t aIndex) {
|
||||
#if ANDROID_VERSION < 17
|
||||
status_t status =
|
||||
AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(aStream), aIndex);
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(aStream),
|
||||
aIndex);
|
||||
#else
|
||||
status_t status =
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(aStream),
|
||||
aIndex,
|
||||
AUDIO_DEVICE_OUT_SPEAKER);
|
||||
#endif
|
||||
|
||||
// sync fm volume with music stream type
|
||||
if (aStream == AUDIO_STREAM_MUSIC && IsDeviceOn(AUDIO_DEVICE_OUT_FM)) {
|
||||
AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_FM), aIndex);
|
||||
#if ANDROID_VERSION < 17
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_FM),
|
||||
aIndex);
|
||||
#else
|
||||
AudioSystem::setStreamVolumeIndex(
|
||||
static_cast<audio_stream_type_t>(AUDIO_STREAM_FM),
|
||||
aIndex,
|
||||
AUDIO_DEVICE_OUT_SPEAKER);
|
||||
#endif
|
||||
mCurrentStreamVolumeTbl[AUDIO_STREAM_FM] = aIndex;
|
||||
}
|
||||
mCurrentStreamVolumeTbl[aStream] = aIndex;
|
||||
|
|
|
@ -223,6 +223,19 @@ typedef enum {
|
|||
AUDIO_CHANNEL_IN_VOICE_DNLINK),
|
||||
} audio_channels_t;
|
||||
|
||||
#if ANDROID_VERSION >= 17
|
||||
typedef enum {
|
||||
AUDIO_MODE_INVALID = -2,
|
||||
AUDIO_MODE_CURRENT = -1,
|
||||
AUDIO_MODE_NORMAL = 0,
|
||||
AUDIO_MODE_RINGTONE = 1,
|
||||
AUDIO_MODE_IN_CALL = 2,
|
||||
AUDIO_MODE_IN_COMMUNICATION = 3,
|
||||
|
||||
AUDIO_MODE_CNT,
|
||||
AUDIO_MODE_MAX = AUDIO_MODE_CNT - 1,
|
||||
} audio_mode_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
|
@ -300,7 +313,13 @@ typedef enum {
|
|||
AUDIO_DEVICE_IN_FM_RX_A2DP |
|
||||
AUDIO_DEVICE_IN_DEFAULT),
|
||||
AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
|
||||
#if ANDROID_VERSION < 17
|
||||
} audio_devices_t;
|
||||
#else
|
||||
};
|
||||
|
||||
typedef uint32_t audio_devices_t;
|
||||
#endif
|
||||
|
||||
/* device connection states used for audio_policy->set_device_connection_state()
|
||||
* */
|
||||
|
@ -650,6 +669,9 @@ public:
|
|||
static status_t setDeviceConnectionState(audio_devices device, device_connection_state state, const char *device_address);
|
||||
static device_connection_state getDeviceConnectionState(audio_devices device, const char *device_address);
|
||||
static status_t setPhoneState(int state);
|
||||
#if ANDROID_VERSION >= 17
|
||||
static status_t setPhoneState(audio_mode_t state);
|
||||
#endif
|
||||
static status_t setRingerMode(uint32_t mode, uint32_t mask);
|
||||
#ifdef VANILLA_ANDROID
|
||||
static status_t setForceUse(force_use usage, forced_config config);
|
||||
|
@ -706,6 +728,14 @@ public:
|
|||
int indexMax);
|
||||
static status_t setStreamVolumeIndex(stream_type stream, int index);
|
||||
static status_t setStreamVolumeIndex(audio_stream_type_t stream, int index);
|
||||
#if ANDROID_VERSION >= 17
|
||||
static status_t setStreamVolumeIndex(audio_stream_type_t stream,
|
||||
int index,
|
||||
audio_devices_t device);
|
||||
static status_t getStreamVolumeIndex(audio_stream_type_t stream,
|
||||
int *index,
|
||||
audio_devices_t device);
|
||||
#endif
|
||||
static status_t getStreamVolumeIndex(stream_type stream, int *index);
|
||||
static status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index);
|
||||
|
||||
|
|
|
@ -600,12 +600,14 @@ enum audio_device_e {
|
|||
DEVICE_EXTERNAL_SPEAKER = 0x800 // external speaker (stereo and High quality)
|
||||
};
|
||||
|
||||
#if ANDROID_VERSION < 17
|
||||
// Audio mode
|
||||
enum audio_mode_e {
|
||||
AUDIO_MODE_NORMAL, // device idle
|
||||
AUDIO_MODE_RINGTONE, // device ringing
|
||||
AUDIO_MODE_IN_CALL // audio call connected (VoIP or telephony)
|
||||
};
|
||||
#endif
|
||||
|
||||
// Values for "accessMode" field of buffer_config_t:
|
||||
// overwrite, read only, accumulate (read/modify/write)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,50 @@
|
|||
/* 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/. */
|
||||
|
||||
enum RTCDataChannelState {
|
||||
"connecting",
|
||||
"open",
|
||||
"closing",
|
||||
"closed"
|
||||
};
|
||||
|
||||
enum RTCDataChannelType {
|
||||
"arraybuffer",
|
||||
"blob"
|
||||
};
|
||||
|
||||
// XXX This interface is called RTCDataChannel in the spec.
|
||||
interface DataChannel : EventTarget
|
||||
{
|
||||
readonly attribute DOMString label;
|
||||
readonly attribute boolean reliable;
|
||||
readonly attribute RTCDataChannelState readyState;
|
||||
readonly attribute unsigned long bufferedAmount;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onopen;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onerror;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onclose;
|
||||
void close();
|
||||
[SetterThrows]
|
||||
attribute EventHandler onmessage;
|
||||
attribute RTCDataChannelType binaryType;
|
||||
[Throws]
|
||||
void send(DOMString data);
|
||||
[Throws]
|
||||
void send(Blob data);
|
||||
[Throws]
|
||||
void send(ArrayBuffer data);
|
||||
[Throws]
|
||||
void send(ArrayBufferView data);
|
||||
};
|
||||
|
||||
// Mozilla extensions.
|
||||
partial interface DataChannel
|
||||
{
|
||||
readonly attribute DOMString protocol;
|
||||
readonly attribute boolean ordered;
|
||||
readonly attribute unsigned short stream;
|
||||
};
|
|
@ -0,0 +1,238 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
interface WindowProxy;
|
||||
|
||||
// http://www.w3.org/TR/1999/WD-DOM-Level-2-19990923/events.html#Events-KeyEvent
|
||||
interface KeyEvent
|
||||
{
|
||||
const unsigned long DOM_VK_CANCEL = 0x03;
|
||||
const unsigned long DOM_VK_HELP = 0x06;
|
||||
const unsigned long DOM_VK_BACK_SPACE = 0x08;
|
||||
const unsigned long DOM_VK_TAB = 0x09;
|
||||
const unsigned long DOM_VK_CLEAR = 0x0C;
|
||||
const unsigned long DOM_VK_RETURN = 0x0D;
|
||||
const unsigned long DOM_VK_ENTER = 0x0E;
|
||||
const unsigned long DOM_VK_SHIFT = 0x10;
|
||||
const unsigned long DOM_VK_CONTROL = 0x11;
|
||||
const unsigned long DOM_VK_ALT = 0x12;
|
||||
const unsigned long DOM_VK_PAUSE = 0x13;
|
||||
const unsigned long DOM_VK_CAPS_LOCK = 0x14;
|
||||
const unsigned long DOM_VK_KANA = 0x15;
|
||||
const unsigned long DOM_VK_HANGUL = 0x15;
|
||||
const unsigned long DOM_VK_EISU = 0x16; // Japanese Mac keyboard only
|
||||
const unsigned long DOM_VK_JUNJA = 0x17;
|
||||
const unsigned long DOM_VK_FINAL = 0x18;
|
||||
const unsigned long DOM_VK_HANJA = 0x19;
|
||||
const unsigned long DOM_VK_KANJI = 0x19;
|
||||
const unsigned long DOM_VK_ESCAPE = 0x1B;
|
||||
const unsigned long DOM_VK_CONVERT = 0x1C;
|
||||
const unsigned long DOM_VK_NONCONVERT = 0x1D;
|
||||
const unsigned long DOM_VK_ACCEPT = 0x1E;
|
||||
const unsigned long DOM_VK_MODECHANGE = 0x1F;
|
||||
const unsigned long DOM_VK_SPACE = 0x20;
|
||||
const unsigned long DOM_VK_PAGE_UP = 0x21;
|
||||
const unsigned long DOM_VK_PAGE_DOWN = 0x22;
|
||||
const unsigned long DOM_VK_END = 0x23;
|
||||
const unsigned long DOM_VK_HOME = 0x24;
|
||||
const unsigned long DOM_VK_LEFT = 0x25;
|
||||
const unsigned long DOM_VK_UP = 0x26;
|
||||
const unsigned long DOM_VK_RIGHT = 0x27;
|
||||
const unsigned long DOM_VK_DOWN = 0x28;
|
||||
const unsigned long DOM_VK_SELECT = 0x29;
|
||||
const unsigned long DOM_VK_PRINT = 0x2A;
|
||||
const unsigned long DOM_VK_EXECUTE = 0x2B;
|
||||
const unsigned long DOM_VK_PRINTSCREEN = 0x2C;
|
||||
const unsigned long DOM_VK_INSERT = 0x2D;
|
||||
const unsigned long DOM_VK_DELETE = 0x2E;
|
||||
|
||||
// DOM_VK_0 - DOM_VK_9 match their ascii values
|
||||
const unsigned long DOM_VK_0 = 0x30;
|
||||
const unsigned long DOM_VK_1 = 0x31;
|
||||
const unsigned long DOM_VK_2 = 0x32;
|
||||
const unsigned long DOM_VK_3 = 0x33;
|
||||
const unsigned long DOM_VK_4 = 0x34;
|
||||
const unsigned long DOM_VK_5 = 0x35;
|
||||
const unsigned long DOM_VK_6 = 0x36;
|
||||
const unsigned long DOM_VK_7 = 0x37;
|
||||
const unsigned long DOM_VK_8 = 0x38;
|
||||
const unsigned long DOM_VK_9 = 0x39;
|
||||
|
||||
const unsigned long DOM_VK_COLON = 0x3A;
|
||||
const unsigned long DOM_VK_SEMICOLON = 0x3B;
|
||||
const unsigned long DOM_VK_LESS_THAN = 0x3C;
|
||||
const unsigned long DOM_VK_EQUALS = 0x3D;
|
||||
const unsigned long DOM_VK_GREATER_THAN = 0x3E;
|
||||
const unsigned long DOM_VK_QUESTION_MARK = 0x3F;
|
||||
const unsigned long DOM_VK_AT = 0x40;
|
||||
|
||||
// DOM_VK_A - DOM_VK_Z match their ascii values
|
||||
const unsigned long DOM_VK_A = 0x41;
|
||||
const unsigned long DOM_VK_B = 0x42;
|
||||
const unsigned long DOM_VK_C = 0x43;
|
||||
const unsigned long DOM_VK_D = 0x44;
|
||||
const unsigned long DOM_VK_E = 0x45;
|
||||
const unsigned long DOM_VK_F = 0x46;
|
||||
const unsigned long DOM_VK_G = 0x47;
|
||||
const unsigned long DOM_VK_H = 0x48;
|
||||
const unsigned long DOM_VK_I = 0x49;
|
||||
const unsigned long DOM_VK_J = 0x4A;
|
||||
const unsigned long DOM_VK_K = 0x4B;
|
||||
const unsigned long DOM_VK_L = 0x4C;
|
||||
const unsigned long DOM_VK_M = 0x4D;
|
||||
const unsigned long DOM_VK_N = 0x4E;
|
||||
const unsigned long DOM_VK_O = 0x4F;
|
||||
const unsigned long DOM_VK_P = 0x50;
|
||||
const unsigned long DOM_VK_Q = 0x51;
|
||||
const unsigned long DOM_VK_R = 0x52;
|
||||
const unsigned long DOM_VK_S = 0x53;
|
||||
const unsigned long DOM_VK_T = 0x54;
|
||||
const unsigned long DOM_VK_U = 0x55;
|
||||
const unsigned long DOM_VK_V = 0x56;
|
||||
const unsigned long DOM_VK_W = 0x57;
|
||||
const unsigned long DOM_VK_X = 0x58;
|
||||
const unsigned long DOM_VK_Y = 0x59;
|
||||
const unsigned long DOM_VK_Z = 0x5A;
|
||||
|
||||
const unsigned long DOM_VK_WIN = 0x5B;
|
||||
const unsigned long DOM_VK_CONTEXT_MENU = 0x5D;
|
||||
const unsigned long DOM_VK_SLEEP = 0x5F;
|
||||
|
||||
// Numpad keys
|
||||
const unsigned long DOM_VK_NUMPAD0 = 0x60;
|
||||
const unsigned long DOM_VK_NUMPAD1 = 0x61;
|
||||
const unsigned long DOM_VK_NUMPAD2 = 0x62;
|
||||
const unsigned long DOM_VK_NUMPAD3 = 0x63;
|
||||
const unsigned long DOM_VK_NUMPAD4 = 0x64;
|
||||
const unsigned long DOM_VK_NUMPAD5 = 0x65;
|
||||
const unsigned long DOM_VK_NUMPAD6 = 0x66;
|
||||
const unsigned long DOM_VK_NUMPAD7 = 0x67;
|
||||
const unsigned long DOM_VK_NUMPAD8 = 0x68;
|
||||
const unsigned long DOM_VK_NUMPAD9 = 0x69;
|
||||
const unsigned long DOM_VK_MULTIPLY = 0x6A;
|
||||
const unsigned long DOM_VK_ADD = 0x6B;
|
||||
const unsigned long DOM_VK_SEPARATOR = 0x6C;
|
||||
const unsigned long DOM_VK_SUBTRACT = 0x6D;
|
||||
const unsigned long DOM_VK_DECIMAL = 0x6E;
|
||||
const unsigned long DOM_VK_DIVIDE = 0x6F;
|
||||
|
||||
const unsigned long DOM_VK_F1 = 0x70;
|
||||
const unsigned long DOM_VK_F2 = 0x71;
|
||||
const unsigned long DOM_VK_F3 = 0x72;
|
||||
const unsigned long DOM_VK_F4 = 0x73;
|
||||
const unsigned long DOM_VK_F5 = 0x74;
|
||||
const unsigned long DOM_VK_F6 = 0x75;
|
||||
const unsigned long DOM_VK_F7 = 0x76;
|
||||
const unsigned long DOM_VK_F8 = 0x77;
|
||||
const unsigned long DOM_VK_F9 = 0x78;
|
||||
const unsigned long DOM_VK_F10 = 0x79;
|
||||
const unsigned long DOM_VK_F11 = 0x7A;
|
||||
const unsigned long DOM_VK_F12 = 0x7B;
|
||||
const unsigned long DOM_VK_F13 = 0x7C;
|
||||
const unsigned long DOM_VK_F14 = 0x7D;
|
||||
const unsigned long DOM_VK_F15 = 0x7E;
|
||||
const unsigned long DOM_VK_F16 = 0x7F;
|
||||
const unsigned long DOM_VK_F17 = 0x80;
|
||||
const unsigned long DOM_VK_F18 = 0x81;
|
||||
const unsigned long DOM_VK_F19 = 0x82;
|
||||
const unsigned long DOM_VK_F20 = 0x83;
|
||||
const unsigned long DOM_VK_F21 = 0x84;
|
||||
const unsigned long DOM_VK_F22 = 0x85;
|
||||
const unsigned long DOM_VK_F23 = 0x86;
|
||||
const unsigned long DOM_VK_F24 = 0x87;
|
||||
|
||||
const unsigned long DOM_VK_NUM_LOCK = 0x90;
|
||||
const unsigned long DOM_VK_SCROLL_LOCK = 0x91;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_JISHO = 0x92;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_MASSHOU = 0x93;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_TOUROKU = 0x94;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_LOYA = 0x95;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_ROYA = 0x96;
|
||||
|
||||
const unsigned long DOM_VK_CIRCUMFLEX = 0xA0;
|
||||
const unsigned long DOM_VK_EXCLAMATION = 0xA1;
|
||||
const unsigned long DOM_VK_DOUBLE_QUOTE = 0xA2;
|
||||
const unsigned long DOM_VK_HASH = 0xA3;
|
||||
const unsigned long DOM_VK_DOLLAR = 0xA4;
|
||||
const unsigned long DOM_VK_PERCENT = 0xA5;
|
||||
const unsigned long DOM_VK_AMPERSAND = 0xA6;
|
||||
const unsigned long DOM_VK_UNDERSCORE = 0xA7;
|
||||
const unsigned long DOM_VK_OPEN_PAREN = 0xA8;
|
||||
const unsigned long DOM_VK_CLOSE_PAREN = 0xA9;
|
||||
const unsigned long DOM_VK_ASTERISK = 0xAA;
|
||||
const unsigned long DOM_VK_PLUS = 0xAB;
|
||||
const unsigned long DOM_VK_PIPE = 0xAC;
|
||||
const unsigned long DOM_VK_HYPHEN_MINUS = 0xAD;
|
||||
|
||||
const unsigned long DOM_VK_OPEN_CURLY_BRACKET = 0xAE;
|
||||
const unsigned long DOM_VK_CLOSE_CURLY_BRACKET = 0xAF;
|
||||
|
||||
const unsigned long DOM_VK_TILDE = 0xB0;
|
||||
|
||||
const unsigned long DOM_VK_VOLUME_MUTE = 0xB5;
|
||||
const unsigned long DOM_VK_VOLUME_DOWN = 0xB6;
|
||||
const unsigned long DOM_VK_VOLUME_UP = 0xB7;
|
||||
|
||||
const unsigned long DOM_VK_COMMA = 0xBC;
|
||||
const unsigned long DOM_VK_PERIOD = 0xBE;
|
||||
const unsigned long DOM_VK_SLASH = 0xBF;
|
||||
const unsigned long DOM_VK_BACK_QUOTE = 0xC0;
|
||||
const unsigned long DOM_VK_OPEN_BRACKET = 0xDB; // square bracket
|
||||
const unsigned long DOM_VK_BACK_SLASH = 0xDC;
|
||||
const unsigned long DOM_VK_CLOSE_BRACKET = 0xDD; // square bracket
|
||||
const unsigned long DOM_VK_QUOTE = 0xDE; // Apostrophe
|
||||
|
||||
const unsigned long DOM_VK_META = 0xE0;
|
||||
const unsigned long DOM_VK_ALTGR = 0xE1;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3;
|
||||
const unsigned long DOM_VK_WIN_ICO_00 = 0xE4;
|
||||
const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6;
|
||||
const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9;
|
||||
const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA1 = 0xEB;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA2 = 0xEC;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA3 = 0xED;
|
||||
const unsigned long DOM_VK_WIN_OEM_WSCTRL = 0xEE;
|
||||
const unsigned long DOM_VK_WIN_OEM_CUSEL = 0xEF;
|
||||
const unsigned long DOM_VK_WIN_OEM_ATTN = 0xF0;
|
||||
const unsigned long DOM_VK_WIN_OEM_FINISH = 0xF1;
|
||||
const unsigned long DOM_VK_WIN_OEM_COPY = 0xF2;
|
||||
const unsigned long DOM_VK_WIN_OEM_AUTO = 0xF3;
|
||||
const unsigned long DOM_VK_WIN_OEM_ENLW = 0xF4;
|
||||
const unsigned long DOM_VK_WIN_OEM_BACKTAB = 0xF5;
|
||||
|
||||
// Following keys are not used on most keyboards. However, for compatibility
|
||||
// with other browsers on Windows, we should define them.
|
||||
const unsigned long DOM_VK_ATTN = 0xF6;
|
||||
const unsigned long DOM_VK_CRSEL = 0xF7;
|
||||
const unsigned long DOM_VK_EXSEL = 0xF8;
|
||||
const unsigned long DOM_VK_EREOF = 0xF9;
|
||||
const unsigned long DOM_VK_PLAY = 0xFA;
|
||||
const unsigned long DOM_VK_ZOOM = 0xFB;
|
||||
const unsigned long DOM_VK_PA1 = 0xFD;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE;
|
||||
|
||||
[Throws]
|
||||
void initKeyEvent(DOMString type,
|
||||
boolean canBubble,
|
||||
boolean cancelable,
|
||||
WindowProxy? view,
|
||||
boolean ctrlKey,
|
||||
boolean altKey,
|
||||
boolean shiftKey,
|
||||
boolean metaKey,
|
||||
unsigned long keyCode,
|
||||
unsigned long charCode);
|
||||
};
|
|
@ -8,221 +8,6 @@ interface WindowProxy;
|
|||
|
||||
interface KeyboardEvent : UIEvent
|
||||
{
|
||||
const unsigned long DOM_VK_CANCEL = 0x03;
|
||||
const unsigned long DOM_VK_HELP = 0x06;
|
||||
const unsigned long DOM_VK_BACK_SPACE = 0x08;
|
||||
const unsigned long DOM_VK_TAB = 0x09;
|
||||
const unsigned long DOM_VK_CLEAR = 0x0C;
|
||||
const unsigned long DOM_VK_RETURN = 0x0D;
|
||||
const unsigned long DOM_VK_ENTER = 0x0E;
|
||||
const unsigned long DOM_VK_SHIFT = 0x10;
|
||||
const unsigned long DOM_VK_CONTROL = 0x11;
|
||||
const unsigned long DOM_VK_ALT = 0x12;
|
||||
const unsigned long DOM_VK_PAUSE = 0x13;
|
||||
const unsigned long DOM_VK_CAPS_LOCK = 0x14;
|
||||
const unsigned long DOM_VK_KANA = 0x15;
|
||||
const unsigned long DOM_VK_HANGUL = 0x15;
|
||||
const unsigned long DOM_VK_EISU = 0x16; // Japanese Mac keyboard only
|
||||
const unsigned long DOM_VK_JUNJA = 0x17;
|
||||
const unsigned long DOM_VK_FINAL = 0x18;
|
||||
const unsigned long DOM_VK_HANJA = 0x19;
|
||||
const unsigned long DOM_VK_KANJI = 0x19;
|
||||
const unsigned long DOM_VK_ESCAPE = 0x1B;
|
||||
const unsigned long DOM_VK_CONVERT = 0x1C;
|
||||
const unsigned long DOM_VK_NONCONVERT = 0x1D;
|
||||
const unsigned long DOM_VK_ACCEPT = 0x1E;
|
||||
const unsigned long DOM_VK_MODECHANGE = 0x1F;
|
||||
const unsigned long DOM_VK_SPACE = 0x20;
|
||||
const unsigned long DOM_VK_PAGE_UP = 0x21;
|
||||
const unsigned long DOM_VK_PAGE_DOWN = 0x22;
|
||||
const unsigned long DOM_VK_END = 0x23;
|
||||
const unsigned long DOM_VK_HOME = 0x24;
|
||||
const unsigned long DOM_VK_LEFT = 0x25;
|
||||
const unsigned long DOM_VK_UP = 0x26;
|
||||
const unsigned long DOM_VK_RIGHT = 0x27;
|
||||
const unsigned long DOM_VK_DOWN = 0x28;
|
||||
const unsigned long DOM_VK_SELECT = 0x29;
|
||||
const unsigned long DOM_VK_PRINT = 0x2A;
|
||||
const unsigned long DOM_VK_EXECUTE = 0x2B;
|
||||
const unsigned long DOM_VK_PRINTSCREEN = 0x2C;
|
||||
const unsigned long DOM_VK_INSERT = 0x2D;
|
||||
const unsigned long DOM_VK_DELETE = 0x2E;
|
||||
|
||||
// DOM_VK_0 - DOM_VK_9 match their ascii values
|
||||
const unsigned long DOM_VK_0 = 0x30;
|
||||
const unsigned long DOM_VK_1 = 0x31;
|
||||
const unsigned long DOM_VK_2 = 0x32;
|
||||
const unsigned long DOM_VK_3 = 0x33;
|
||||
const unsigned long DOM_VK_4 = 0x34;
|
||||
const unsigned long DOM_VK_5 = 0x35;
|
||||
const unsigned long DOM_VK_6 = 0x36;
|
||||
const unsigned long DOM_VK_7 = 0x37;
|
||||
const unsigned long DOM_VK_8 = 0x38;
|
||||
const unsigned long DOM_VK_9 = 0x39;
|
||||
|
||||
const unsigned long DOM_VK_COLON = 0x3A;
|
||||
const unsigned long DOM_VK_SEMICOLON = 0x3B;
|
||||
const unsigned long DOM_VK_LESS_THAN = 0x3C;
|
||||
const unsigned long DOM_VK_EQUALS = 0x3D;
|
||||
const unsigned long DOM_VK_GREATER_THAN = 0x3E;
|
||||
const unsigned long DOM_VK_QUESTION_MARK = 0x3F;
|
||||
const unsigned long DOM_VK_AT = 0x40;
|
||||
|
||||
// DOM_VK_A - DOM_VK_Z match their ascii values
|
||||
const unsigned long DOM_VK_A = 0x41;
|
||||
const unsigned long DOM_VK_B = 0x42;
|
||||
const unsigned long DOM_VK_C = 0x43;
|
||||
const unsigned long DOM_VK_D = 0x44;
|
||||
const unsigned long DOM_VK_E = 0x45;
|
||||
const unsigned long DOM_VK_F = 0x46;
|
||||
const unsigned long DOM_VK_G = 0x47;
|
||||
const unsigned long DOM_VK_H = 0x48;
|
||||
const unsigned long DOM_VK_I = 0x49;
|
||||
const unsigned long DOM_VK_J = 0x4A;
|
||||
const unsigned long DOM_VK_K = 0x4B;
|
||||
const unsigned long DOM_VK_L = 0x4C;
|
||||
const unsigned long DOM_VK_M = 0x4D;
|
||||
const unsigned long DOM_VK_N = 0x4E;
|
||||
const unsigned long DOM_VK_O = 0x4F;
|
||||
const unsigned long DOM_VK_P = 0x50;
|
||||
const unsigned long DOM_VK_Q = 0x51;
|
||||
const unsigned long DOM_VK_R = 0x52;
|
||||
const unsigned long DOM_VK_S = 0x53;
|
||||
const unsigned long DOM_VK_T = 0x54;
|
||||
const unsigned long DOM_VK_U = 0x55;
|
||||
const unsigned long DOM_VK_V = 0x56;
|
||||
const unsigned long DOM_VK_W = 0x57;
|
||||
const unsigned long DOM_VK_X = 0x58;
|
||||
const unsigned long DOM_VK_Y = 0x59;
|
||||
const unsigned long DOM_VK_Z = 0x5A;
|
||||
|
||||
const unsigned long DOM_VK_WIN = 0x5B;
|
||||
const unsigned long DOM_VK_CONTEXT_MENU = 0x5D;
|
||||
const unsigned long DOM_VK_SLEEP = 0x5F;
|
||||
|
||||
// Numpad keys
|
||||
const unsigned long DOM_VK_NUMPAD0 = 0x60;
|
||||
const unsigned long DOM_VK_NUMPAD1 = 0x61;
|
||||
const unsigned long DOM_VK_NUMPAD2 = 0x62;
|
||||
const unsigned long DOM_VK_NUMPAD3 = 0x63;
|
||||
const unsigned long DOM_VK_NUMPAD4 = 0x64;
|
||||
const unsigned long DOM_VK_NUMPAD5 = 0x65;
|
||||
const unsigned long DOM_VK_NUMPAD6 = 0x66;
|
||||
const unsigned long DOM_VK_NUMPAD7 = 0x67;
|
||||
const unsigned long DOM_VK_NUMPAD8 = 0x68;
|
||||
const unsigned long DOM_VK_NUMPAD9 = 0x69;
|
||||
const unsigned long DOM_VK_MULTIPLY = 0x6A;
|
||||
const unsigned long DOM_VK_ADD = 0x6B;
|
||||
const unsigned long DOM_VK_SEPARATOR = 0x6C;
|
||||
const unsigned long DOM_VK_SUBTRACT = 0x6D;
|
||||
const unsigned long DOM_VK_DECIMAL = 0x6E;
|
||||
const unsigned long DOM_VK_DIVIDE = 0x6F;
|
||||
|
||||
const unsigned long DOM_VK_F1 = 0x70;
|
||||
const unsigned long DOM_VK_F2 = 0x71;
|
||||
const unsigned long DOM_VK_F3 = 0x72;
|
||||
const unsigned long DOM_VK_F4 = 0x73;
|
||||
const unsigned long DOM_VK_F5 = 0x74;
|
||||
const unsigned long DOM_VK_F6 = 0x75;
|
||||
const unsigned long DOM_VK_F7 = 0x76;
|
||||
const unsigned long DOM_VK_F8 = 0x77;
|
||||
const unsigned long DOM_VK_F9 = 0x78;
|
||||
const unsigned long DOM_VK_F10 = 0x79;
|
||||
const unsigned long DOM_VK_F11 = 0x7A;
|
||||
const unsigned long DOM_VK_F12 = 0x7B;
|
||||
const unsigned long DOM_VK_F13 = 0x7C;
|
||||
const unsigned long DOM_VK_F14 = 0x7D;
|
||||
const unsigned long DOM_VK_F15 = 0x7E;
|
||||
const unsigned long DOM_VK_F16 = 0x7F;
|
||||
const unsigned long DOM_VK_F17 = 0x80;
|
||||
const unsigned long DOM_VK_F18 = 0x81;
|
||||
const unsigned long DOM_VK_F19 = 0x82;
|
||||
const unsigned long DOM_VK_F20 = 0x83;
|
||||
const unsigned long DOM_VK_F21 = 0x84;
|
||||
const unsigned long DOM_VK_F22 = 0x85;
|
||||
const unsigned long DOM_VK_F23 = 0x86;
|
||||
const unsigned long DOM_VK_F24 = 0x87;
|
||||
|
||||
const unsigned long DOM_VK_NUM_LOCK = 0x90;
|
||||
const unsigned long DOM_VK_SCROLL_LOCK = 0x91;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_JISHO = 0x92;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_MASSHOU = 0x93;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_TOUROKU = 0x94;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_LOYA = 0x95;
|
||||
const unsigned long DOM_VK_WIN_OEM_FJ_ROYA = 0x96;
|
||||
|
||||
const unsigned long DOM_VK_CIRCUMFLEX = 0xA0;
|
||||
const unsigned long DOM_VK_EXCLAMATION = 0xA1;
|
||||
const unsigned long DOM_VK_DOUBLE_QUOTE = 0xA2;
|
||||
const unsigned long DOM_VK_HASH = 0xA3;
|
||||
const unsigned long DOM_VK_DOLLAR = 0xA4;
|
||||
const unsigned long DOM_VK_PERCENT = 0xA5;
|
||||
const unsigned long DOM_VK_AMPERSAND = 0xA6;
|
||||
const unsigned long DOM_VK_UNDERSCORE = 0xA7;
|
||||
const unsigned long DOM_VK_OPEN_PAREN = 0xA8;
|
||||
const unsigned long DOM_VK_CLOSE_PAREN = 0xA9;
|
||||
const unsigned long DOM_VK_ASTERISK = 0xAA;
|
||||
const unsigned long DOM_VK_PLUS = 0xAB;
|
||||
const unsigned long DOM_VK_PIPE = 0xAC;
|
||||
const unsigned long DOM_VK_HYPHEN_MINUS = 0xAD;
|
||||
|
||||
const unsigned long DOM_VK_OPEN_CURLY_BRACKET = 0xAE;
|
||||
const unsigned long DOM_VK_CLOSE_CURLY_BRACKET = 0xAF;
|
||||
|
||||
const unsigned long DOM_VK_TILDE = 0xB0;
|
||||
|
||||
const unsigned long DOM_VK_VOLUME_MUTE = 0xB5;
|
||||
const unsigned long DOM_VK_VOLUME_DOWN = 0xB6;
|
||||
const unsigned long DOM_VK_VOLUME_UP = 0xB7;
|
||||
|
||||
const unsigned long DOM_VK_COMMA = 0xBC;
|
||||
const unsigned long DOM_VK_PERIOD = 0xBE;
|
||||
const unsigned long DOM_VK_SLASH = 0xBF;
|
||||
const unsigned long DOM_VK_BACK_QUOTE = 0xC0;
|
||||
const unsigned long DOM_VK_OPEN_BRACKET = 0xDB; // square bracket
|
||||
const unsigned long DOM_VK_BACK_SLASH = 0xDC;
|
||||
const unsigned long DOM_VK_CLOSE_BRACKET = 0xDD; // square bracket
|
||||
const unsigned long DOM_VK_QUOTE = 0xDE; // Apostrophe
|
||||
|
||||
const unsigned long DOM_VK_META = 0xE0;
|
||||
const unsigned long DOM_VK_ALTGR = 0xE1;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3;
|
||||
const unsigned long DOM_VK_WIN_ICO_00 = 0xE4;
|
||||
const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6;
|
||||
const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9;
|
||||
const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA1 = 0xEB;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA2 = 0xEC;
|
||||
const unsigned long DOM_VK_WIN_OEM_PA3 = 0xED;
|
||||
const unsigned long DOM_VK_WIN_OEM_WSCTRL = 0xEE;
|
||||
const unsigned long DOM_VK_WIN_OEM_CUSEL = 0xEF;
|
||||
const unsigned long DOM_VK_WIN_OEM_ATTN = 0xF0;
|
||||
const unsigned long DOM_VK_WIN_OEM_FINISH = 0xF1;
|
||||
const unsigned long DOM_VK_WIN_OEM_COPY = 0xF2;
|
||||
const unsigned long DOM_VK_WIN_OEM_AUTO = 0xF3;
|
||||
const unsigned long DOM_VK_WIN_OEM_ENLW = 0xF4;
|
||||
const unsigned long DOM_VK_WIN_OEM_BACKTAB = 0xF5;
|
||||
|
||||
// Following keys are not used on most keyboards. However, for compatibility
|
||||
// with other browsers on Windows, we should define them.
|
||||
const unsigned long DOM_VK_ATTN = 0xF6;
|
||||
const unsigned long DOM_VK_CRSEL = 0xF7;
|
||||
const unsigned long DOM_VK_EXSEL = 0xF8;
|
||||
const unsigned long DOM_VK_EREOF = 0xF9;
|
||||
const unsigned long DOM_VK_PLAY = 0xFA;
|
||||
const unsigned long DOM_VK_ZOOM = 0xFB;
|
||||
const unsigned long DOM_VK_PA1 = 0xFD;
|
||||
|
||||
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
|
||||
// for compatibility with the other web browsers on Windows.
|
||||
const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE;
|
||||
|
||||
readonly attribute unsigned long charCode;
|
||||
readonly attribute unsigned long keyCode;
|
||||
|
||||
|
@ -231,18 +16,6 @@ interface KeyboardEvent : UIEvent
|
|||
readonly attribute boolean shiftKey;
|
||||
readonly attribute boolean metaKey;
|
||||
|
||||
[Throws]
|
||||
void initKeyEvent(DOMString type,
|
||||
boolean canBubble,
|
||||
boolean cancelable,
|
||||
WindowProxy? view,
|
||||
boolean ctrlKey,
|
||||
boolean altKey,
|
||||
boolean shiftKey,
|
||||
boolean metaKey,
|
||||
unsigned long keyCode,
|
||||
unsigned long charCode);
|
||||
|
||||
boolean getModifierState(DOMString key);
|
||||
|
||||
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
|
||||
|
@ -256,3 +29,6 @@ interface KeyboardEvent : UIEvent
|
|||
|
||||
readonly attribute DOMString key;
|
||||
};
|
||||
|
||||
// Mozilla extensions
|
||||
KeyboardEvent implements KeyEvent;
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
*/
|
||||
|
||||
interface SVGAnimatedRect {
|
||||
[GetterThrows]
|
||||
readonly attribute SVGRect? baseVal;
|
||||
[GetterThrows]
|
||||
readonly attribute SVGRect? animVal;
|
||||
};
|
||||
|
|
|
@ -161,6 +161,7 @@ webidl_files = \
|
|||
ImageDocument.webidl \
|
||||
InspectorUtils.webidl \
|
||||
KeyboardEvent.webidl \
|
||||
KeyEvent.webidl \
|
||||
LinkStyle.webidl \
|
||||
LocalMediaStream.webidl \
|
||||
Location.webidl \
|
||||
|
@ -358,6 +359,7 @@ endif
|
|||
|
||||
ifdef MOZ_WEBRTC
|
||||
webidl_files += \
|
||||
DataChannel.webidl \
|
||||
MediaStreamList.webidl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
|
|
@ -57,8 +57,8 @@ nsresult CentralizedAdminPrefManagerInit()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Unwrap, store and root the sandbox.
|
||||
rv = sandbox->GetJSObject(&autoconfigSb);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
autoconfigSb = sandbox->GetJSObject();
|
||||
NS_ENSURE_STATE(autoconfigSb);
|
||||
autoconfigSb = js::UncheckedUnwrap(autoconfigSb);
|
||||
JSAutoCompartment ac(cx, autoconfigSb);
|
||||
if (!JS_AddNamedObjectRoot(cx, &autoconfigSb, "AutoConfig Sandbox"))
|
||||
|
|
|
@ -352,6 +352,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
const char *rendererMatchStrings[RendererOther] = {
|
||||
"Adreno 200",
|
||||
"Adreno 205",
|
||||
"Adreno (TM) 205",
|
||||
"Adreno (TM) 320",
|
||||
"PowerVR SGX 530",
|
||||
"PowerVR SGX 540"
|
||||
|
|
|
@ -297,7 +297,8 @@ public:
|
|||
enum {
|
||||
RendererAdreno200,
|
||||
RendererAdreno205,
|
||||
RendererAdreno320,
|
||||
RendererAdrenoTM205,
|
||||
RendererAdrenoTM320,
|
||||
RendererSGX530,
|
||||
RendererSGX540,
|
||||
RendererOther
|
||||
|
|
|
@ -37,10 +37,11 @@ D3D9SurfaceImage::SetData(const Data& aData)
|
|||
// DXVA surfaces aren't created sharable, so we need to copy the surface
|
||||
// to a sharable texture to that it's accessible to the layer manager's
|
||||
// device.
|
||||
const nsIntRect& region = aData.mRegion;
|
||||
RefPtr<IDirect3DTexture9> texture;
|
||||
HANDLE shareHandle = NULL;
|
||||
hr = device->CreateTexture(desc.Width,
|
||||
desc.Height,
|
||||
hr = device->CreateTexture(region.width,
|
||||
region.height,
|
||||
1,
|
||||
D3DUSAGE_RENDERTARGET,
|
||||
D3DFMT_X8R8G8B8,
|
||||
|
@ -57,7 +58,8 @@ D3D9SurfaceImage::SetData(const Data& aData)
|
|||
// Stash the surface description for later use.
|
||||
textureSurface->GetDesc(&mDesc);
|
||||
|
||||
hr = device->StretchRect(surface, NULL, textureSurface, NULL, D3DTEXF_NONE);
|
||||
RECT src = { region.x, region.y, region.x+region.width, region.y+region.height };
|
||||
hr = device->StretchRect(surface, &src, textureSurface, NULL, D3DTEXF_NONE);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
// Flush the draw command now, so that by the time we come to draw this
|
||||
|
@ -71,7 +73,7 @@ D3D9SurfaceImage::SetData(const Data& aData)
|
|||
|
||||
mTexture = texture;
|
||||
mShareHandle = shareHandle;
|
||||
mSize = gfxIntSize(aData.mSize.width, aData.mSize.height);
|
||||
mSize = gfxIntSize(region.width, region.height);
|
||||
mQuery = query;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -22,10 +22,10 @@ class D3D9SurfaceImage : public Image {
|
|||
public:
|
||||
|
||||
struct Data {
|
||||
Data(IDirect3DSurface9* aSurface, const nsIntSize& aSize)
|
||||
: mSurface(aSurface), mSize(aSize) {}
|
||||
Data(IDirect3DSurface9* aSurface, const nsIntRect& aRegion)
|
||||
: mSurface(aSurface), mRegion(aRegion) {}
|
||||
RefPtr<IDirect3DSurface9> mSurface;
|
||||
nsIntSize mSize;
|
||||
nsIntRect mRegion;
|
||||
};
|
||||
|
||||
D3D9SurfaceImage() : Image(NULL, D3D9_RGB32_TEXTURE), mSize(0, 0) {}
|
||||
|
|
|
@ -313,7 +313,6 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
|||
c->GetInheritedYScale(),
|
||||
1);
|
||||
}
|
||||
NS_ASSERTION(!aLayer->GetIsFixedPosition(), "Can't animate transforms on fixed-position layers");
|
||||
layerComposite->SetShadowTransform(matrix);
|
||||
layerComposite->SetShadowTransformSetByAnimation(true);
|
||||
break;
|
||||
|
|
|
@ -839,6 +839,19 @@ GrallocTextureHostOGL::Unlock()
|
|||
* i.e. before the next time that we will try to acquire a write lock on the same buffer,
|
||||
* because read and write locks on gralloc buffers are mutually exclusive.
|
||||
*/
|
||||
if (mGL->Renderer() == GLContext::RendererAdrenoTM205) {
|
||||
/* XXX This is working around a driver bug exhibited on at least the
|
||||
* Geeksphone Peak, where retargeting to a different EGL image is very
|
||||
* slow. See Bug 869696.
|
||||
*/
|
||||
if (mGLTexture) {
|
||||
mGL->MakeCurrent();
|
||||
mGL->fDeleteTextures(1, &mGLTexture);
|
||||
mGLTexture = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mGL->MakeCurrent();
|
||||
mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
mGL->fBindTexture(mTextureTarget, mGLTexture);
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -2,6 +2,7 @@ asserts(0-2) load ownerdiscard.html # bug 804291, bug 807211
|
|||
|
||||
load 83804-1.gif
|
||||
load 89341-1.gif
|
||||
load 463696.bmp
|
||||
load 570451.png
|
||||
|
||||
load colormap-range.gif
|
||||
|
|
|
@ -1026,9 +1026,8 @@ XPCShellEnvironment::Init()
|
|||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> globalObj(cx);
|
||||
rv = holder->GetJSObject(globalObj.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
JS::Rooted<JSObject*> globalObj(cx, holder->GetJSObject());
|
||||
if (!globalObj) {
|
||||
NS_ERROR("Failed to get global JSObject!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6242,8 +6242,9 @@ CodeGenerator::visitGetDOMProperty(LGetDOMProperty *ins)
|
|||
|
||||
masm.checkStackAlignment();
|
||||
|
||||
/* Make Space for the outparam */
|
||||
masm.adjustStack(-int32_t(sizeof(Value)));
|
||||
// Make space for the outparam. Pre-initialize it to UndefinedValue so we
|
||||
// can trace it at GC time.
|
||||
masm.Push(UndefinedValue());
|
||||
masm.movePtr(StackPointer, ValueReg);
|
||||
|
||||
masm.Push(ObjectReg);
|
||||
|
@ -6307,7 +6308,7 @@ CodeGenerator::visitSetDOMProperty(LSetDOMProperty *ins)
|
|||
|
||||
masm.checkStackAlignment();
|
||||
|
||||
// Push thei argument. Rooting will happen at GC time.
|
||||
// Push the argument. Rooting will happen at GC time.
|
||||
ValueOperand argVal = ToValue(ins, LSetDOMProperty::Value);
|
||||
masm.Push(argVal);
|
||||
masm.movePtr(StackPointer, ValueReg);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче