mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out bug 919457 for build bustage. r=me
This commit is contained in:
parent
60f7948e75
commit
067126c359
@ -24,9 +24,8 @@
|
||||
# their primary interface (and hence whose prototype is this
|
||||
# interface's prototype object). Always False for callback
|
||||
# interfaces. Defaults to True otherwise.
|
||||
# * workers - Indicates whether the descriptor is intended to be used solely
|
||||
# for worker threads (defaults to false). If true the interface
|
||||
# will not be made available on the main thread.
|
||||
# * workers - Indicates whether the descriptor is intended to be used for
|
||||
# worker threads (defaults to false).
|
||||
# * customTrace - The native class will use a custom trace hook (defaults to
|
||||
# true for workers, false otherwise).
|
||||
# * customFinalize - The native class will use a custom finalize hook
|
||||
@ -60,7 +59,7 @@
|
||||
# call delete through XPConnect's deferred finalization
|
||||
# mechanism, for a refcounted object it'll call Release
|
||||
# through XPConnect's deferred finalization mechanism.
|
||||
# 'worker' opts into old style worker models. Defaults to
|
||||
# Always 'worker' for worker descriptors. Defaults to
|
||||
# 'refcounted'.
|
||||
#
|
||||
# The following fields are either a string, an array (defaults to an empty
|
||||
@ -388,14 +387,7 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeOwnership': 'worker',
|
||||
'concrete': False,
|
||||
# XXXkhuey ownerGlobal returns WindowProxy? which boils down to a JSObject*
|
||||
# on a worker, and nsRefPtr<JSObject> fails in the expected way. This is
|
||||
# ugly but it's all going away soon anyways.
|
||||
'resultNotAddRefed': [
|
||||
'ownerGlobal'
|
||||
]
|
||||
'concrete': False
|
||||
}],
|
||||
|
||||
'Exception': {
|
||||
@ -422,7 +414,6 @@ DOMInterfaces = {
|
||||
|
||||
'FileReaderSync': {
|
||||
'workers': True,
|
||||
'wrapperCache': False,
|
||||
},
|
||||
|
||||
'FileRequest': {
|
||||
@ -1254,7 +1245,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeOwnership': 'worker',
|
||||
}],
|
||||
|
||||
'VTTCue': {
|
||||
@ -1435,11 +1425,13 @@ DOMInterfaces = {
|
||||
|
||||
'WorkerLocation': {
|
||||
'headerFile': 'mozilla/dom/workers/bindings/Location.h',
|
||||
'castable': True,
|
||||
'workers': True,
|
||||
},
|
||||
|
||||
'WorkerNavigator': {
|
||||
'headerFile': 'mozilla/dom/workers/bindings/Navigator.h',
|
||||
'castable': True,
|
||||
'workers': True,
|
||||
},
|
||||
|
||||
@ -1451,13 +1443,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeOwnership': 'worker',
|
||||
# XXXkhuey responseXML returns Document? which boils down to a JSObject*
|
||||
# on a worker, and nsRefPtr<JSObject> fails in the expected way. channel is
|
||||
# similar. This is ugly but it's all going away soon anyways.
|
||||
'resultNotAddRefed': [
|
||||
'responseXML', 'channel'
|
||||
]
|
||||
}],
|
||||
|
||||
'XMLHttpRequestEventTarget': [
|
||||
@ -1468,7 +1453,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeOwnership': 'worker',
|
||||
'concrete': False,
|
||||
}],
|
||||
|
||||
@ -1479,7 +1463,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeOwnership': 'worker',
|
||||
}],
|
||||
|
||||
'XMLSerializer': {
|
||||
|
@ -147,7 +147,7 @@ def DOMClass(descriptor):
|
||||
# padding.
|
||||
protoList.extend(['prototypes::id::_ID_Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
||||
prototypeChainString = ', '.join(protoList)
|
||||
if descriptor.nativeOwnership == 'worker':
|
||||
if descriptor.workers:
|
||||
participant = "nullptr"
|
||||
else:
|
||||
participant = "GetCCParticipant<%s>::Get()" % descriptor.nativeType
|
||||
@ -209,7 +209,7 @@ static const DOMJSClass Class = {
|
||||
};
|
||||
""" % (self.descriptor.interface.identifier.name,
|
||||
classFlags,
|
||||
ADDPROPERTY_HOOK_NAME if self.descriptor.concrete and not self.descriptor.nativeOwnership == 'worker' and self.descriptor.wrapperCache else 'JS_PropertyStub',
|
||||
ADDPROPERTY_HOOK_NAME if self.descriptor.concrete and not self.descriptor.workers and self.descriptor.wrapperCache else 'JS_PropertyStub',
|
||||
enumerateHook, newResolveHook, FINALIZE_HOOK_NAME, callHook, traceHook,
|
||||
CGIndenter(CGGeneric(DOMClass(self.descriptor))).define())
|
||||
|
||||
@ -1027,7 +1027,7 @@ class CGAddPropertyHook(CGAbstractClassHook):
|
||||
'bool', args)
|
||||
|
||||
def generate_code(self):
|
||||
assert not self.descriptor.nativeOwnership == 'worker' and self.descriptor.wrapperCache
|
||||
assert not self.descriptor.workers and self.descriptor.wrapperCache
|
||||
return (" // We don't want to preserve if we don't have a wrapper.\n"
|
||||
" if (self->GetWrapperPreserveColor()) {\n"
|
||||
" PreserveWrapper(self);\n"
|
||||
@ -1050,7 +1050,7 @@ def finalizeHook(descriptor, hookName, context):
|
||||
finalize += "ClearWrapper(self, self);\n"
|
||||
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
|
||||
finalize += "self->mExpandoAndGeneration.expando = JS::UndefinedValue();\n"
|
||||
if descriptor.nativeOwnership == 'worker':
|
||||
if descriptor.workers:
|
||||
finalize += "self->Release();"
|
||||
else:
|
||||
finalize += ("AddForDeferredFinalization<%s, %s >(self);" %
|
||||
@ -4459,8 +4459,9 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
||||
raise TypeError("Don't know how to declare return value for %s" %
|
||||
returnType)
|
||||
|
||||
def isResultAlreadyAddRefed(extendedAttributes):
|
||||
return not 'resultNotAddRefed' in extendedAttributes
|
||||
def isResultAlreadyAddRefed(descriptor, extendedAttributes):
|
||||
# Default to already_AddRefed on the main thread, raw pointer in workers
|
||||
return not descriptor.workers and not 'resultNotAddRefed' in extendedAttributes
|
||||
|
||||
def needCx(returnType, arguments, extendedAttributes, considerTypes):
|
||||
return (considerTypes and
|
||||
@ -4491,7 +4492,8 @@ class CGCallGenerator(CGThing):
|
||||
|
||||
isFallible = errorReport is not None
|
||||
|
||||
resultAlreadyAddRefed = isResultAlreadyAddRefed(extendedAttributes)
|
||||
resultAlreadyAddRefed = isResultAlreadyAddRefed(descriptorProvider,
|
||||
extendedAttributes)
|
||||
(result, resultOutParam,
|
||||
resultRooter, resultArgs) = getRetvalDeclarationForType(
|
||||
returnType, descriptorProvider, resultAlreadyAddRefed)
|
||||
@ -4858,13 +4860,14 @@ if (!${obj}) {
|
||||
isCreator = memberIsCreator(self.idlNode)
|
||||
if isCreator:
|
||||
# We better be returning addrefed things!
|
||||
assert(isResultAlreadyAddRefed(self.extendedAttributes) or
|
||||
assert(isResultAlreadyAddRefed(self.descriptor,
|
||||
self.extendedAttributes) or
|
||||
# Creators can return raw pointers to owned objects
|
||||
(self.returnType.isGeckoInterface() and
|
||||
self.descriptor.getDescriptor(self.returnType.unroll().inner.identifier.name).nativeOwnership == 'owned') or
|
||||
# Workers use raw pointers for new-object return
|
||||
# values or something
|
||||
self.descriptor.getDescriptor(self.returnType.unroll().inner.identifier.name).nativeOwnership == 'worker')
|
||||
self.descriptor.workers)
|
||||
|
||||
resultTemplateValues = { 'jsvalRef': 'args.rval()',
|
||||
'jsvalHandle': 'args.rval()',
|
||||
@ -6080,6 +6083,10 @@ def getUnionAccessorSignatureType(type, descriptorProvider):
|
||||
return CGGeneric(type.inner.identifier.name)
|
||||
|
||||
if type.isCallback():
|
||||
if descriptorProvider.workers:
|
||||
if type.nullable():
|
||||
return CGGeneric("JSObject*")
|
||||
return CGGeneric("JSObject&")
|
||||
if type.nullable():
|
||||
typeName = "%s*"
|
||||
else:
|
||||
@ -7980,7 +7987,7 @@ class CGDescriptor(CGThing):
|
||||
cgThings.append(CGConstructNavigatorObject(descriptor))
|
||||
|
||||
if descriptor.concrete and not descriptor.proxy:
|
||||
if not descriptor.nativeOwnership == 'worker' and descriptor.wrapperCache:
|
||||
if not descriptor.workers and descriptor.wrapperCache:
|
||||
cgThings.append(CGAddPropertyHook(descriptor))
|
||||
|
||||
# Always have a finalize hook, regardless of whether the class
|
||||
@ -9022,7 +9029,8 @@ class CGNativeMember(ClassMethod):
|
||||
self.descriptorProvider = descriptorProvider
|
||||
self.member = member
|
||||
self.extendedAttrs = extendedAttrs
|
||||
self.resultAlreadyAddRefed = isResultAlreadyAddRefed(self.extendedAttrs)
|
||||
self.resultAlreadyAddRefed = isResultAlreadyAddRefed(self.descriptorProvider,
|
||||
self.extendedAttrs)
|
||||
self.passJSBitsAsNeeded = passJSBitsAsNeeded
|
||||
self.jsObjectsArePtr = jsObjectsArePtr
|
||||
self.variadicIsSequence = variadicIsSequence
|
||||
|
@ -346,7 +346,7 @@ class Descriptor(DescriptorProvider):
|
||||
iface = iface.parent
|
||||
self.operations = operations
|
||||
|
||||
if self.workers and desc.get('nativeOwnership', None) == 'worker':
|
||||
if self.workers and desc.get('nativeOwnership', 'worker') == 'worker':
|
||||
self.nativeOwnership = "worker"
|
||||
else:
|
||||
self.nativeOwnership = desc.get('nativeOwnership', 'refcounted')
|
||||
@ -356,8 +356,6 @@ class Descriptor(DescriptorProvider):
|
||||
(self.interface.identifier.name, self.nativeOwnership))
|
||||
self.customTrace = desc.get('customTrace', self.workers)
|
||||
self.customFinalize = desc.get('customFinalize', self.workers)
|
||||
if desc.get('wantsQI', None) != None:
|
||||
self._wantsQI = desc.get('wantsQI', None)
|
||||
self.wrapperCache = (not self.interface.isCallback() and
|
||||
(self.nativeOwnership == 'worker' or
|
||||
(self.nativeOwnership != 'owned' and
|
||||
|
@ -6,16 +6,22 @@
|
||||
#ifndef mozilla_dom_workers_dombindinginlines_h__
|
||||
#define mozilla_dom_workers_dombindinginlines_h__
|
||||
|
||||
#include "mozilla/dom/FileReaderSyncBinding.h"
|
||||
#include "mozilla/dom/JSSlots.h"
|
||||
#include "mozilla/dom/XMLHttpRequestBinding.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/dom/WorkerLocationBinding.h"
|
||||
#include "mozilla/dom/WorkerNavigatorBinding.h"
|
||||
#include "mozilla/dom/URLBinding.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class FileReaderSync;
|
||||
class XMLHttpRequest;
|
||||
class XMLHttpRequestUpload;
|
||||
class WorkerLocation;
|
||||
class WorkerNavigator;
|
||||
class URL;
|
||||
|
||||
namespace {
|
||||
@ -45,8 +51,11 @@ struct WrapPrototypeTraits
|
||||
} \
|
||||
};
|
||||
|
||||
SPECIALIZE_PROTO_TRAITS(FileReaderSync)
|
||||
SPECIALIZE_PROTO_TRAITS(XMLHttpRequest)
|
||||
SPECIALIZE_PROTO_TRAITS(XMLHttpRequestUpload)
|
||||
SPECIALIZE_PROTO_TRAITS(WorkerLocation)
|
||||
SPECIALIZE_PROTO_TRAITS(WorkerNavigator)
|
||||
SPECIALIZE_PROTO_TRAITS(URL)
|
||||
|
||||
#undef SPECIALIZE_PROTO_TRAITS
|
||||
|
@ -33,25 +33,45 @@ using namespace mozilla;
|
||||
using mozilla::dom::Optional;
|
||||
using mozilla::dom::GlobalObject;
|
||||
|
||||
NS_IMPL_ADDREF(FileReaderSync)
|
||||
NS_IMPL_RELEASE(FileReaderSync)
|
||||
NS_IMPL_ADDREF_INHERITED(FileReaderSync, DOMBindingBase)
|
||||
NS_IMPL_RELEASE_INHERITED(FileReaderSync, DOMBindingBase)
|
||||
NS_INTERFACE_MAP_BEGIN(FileReaderSync)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICharsetDetectionObserver)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMBindingBase)
|
||||
|
||||
FileReaderSync::FileReaderSync(JSContext* aCx)
|
||||
: DOMBindingBase(aCx)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FileReaderSync::_trace(JSTracer* aTrc)
|
||||
{
|
||||
DOMBindingBase::_trace(aTrc);
|
||||
}
|
||||
|
||||
void
|
||||
FileReaderSync::_finalize(JSFreeOp* aFop)
|
||||
{
|
||||
DOMBindingBase::_finalize(aFop);
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<FileReaderSync>
|
||||
FileReaderSync*
|
||||
FileReaderSync::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<FileReaderSync> frs = new FileReaderSync();
|
||||
nsRefPtr<FileReaderSync> frs = new FileReaderSync(aGlobal.GetContext());
|
||||
|
||||
return frs.forget();
|
||||
if (!Wrap(aGlobal.GetContext(), aGlobal.Get(), frs)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return frs;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
FileReaderSync::ReadAsArrayBuffer(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScopeObj,
|
||||
JS::Handle<JSObject*> aBlob,
|
||||
FileReaderSync::ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aBlob,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDOMBlob* blob = file::GetDOMBlobFromJSObject(aBlob);
|
||||
|
@ -8,11 +8,11 @@
|
||||
#define mozilla_dom_workers_filereadersync_h__
|
||||
|
||||
#include "Workers.h"
|
||||
#include "mozilla/dom/workers/bindings/DOMBindingBase.h"
|
||||
|
||||
#include "nsICharsetDetectionObserver.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/FileReaderSyncBinding.h"
|
||||
|
||||
class nsIInputStream;
|
||||
class nsIDOMBlob;
|
||||
@ -28,7 +28,8 @@ template<typename> class Optional;
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class FileReaderSync MOZ_FINAL : public nsICharsetDetectionObserver
|
||||
class FileReaderSync MOZ_FINAL : public DOMBindingBase,
|
||||
public nsICharsetDetectionObserver
|
||||
{
|
||||
nsCString mCharset;
|
||||
nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
|
||||
@ -36,18 +37,20 @@ class FileReaderSync MOZ_FINAL : public nsICharsetDetectionObserver
|
||||
nsresult GuessCharset(nsIInputStream *aStream, nsACString &aCharset);
|
||||
|
||||
public:
|
||||
static already_AddRefed<FileReaderSync>
|
||||
virtual void
|
||||
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
||||
|
||||
static FileReaderSync*
|
||||
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return FileReaderSyncBinding_workers::Wrap(aCx, aScope, this);
|
||||
}
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
FileReaderSync(JSContext* aCx);
|
||||
|
||||
JSObject* ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aScopeObj,
|
||||
JS::Handle<JSObject*> aBlob,
|
||||
JSObject* ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aBlob,
|
||||
ErrorResult& aRv);
|
||||
void ReadAsBinaryString(JS::Handle<JSObject*> aBlob, nsAString& aResult,
|
||||
ErrorResult& aRv);
|
||||
|
@ -8,21 +8,16 @@
|
||||
#include "DOMBindingInlines.h"
|
||||
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "mozilla/dom/WorkerLocationBinding.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerLocation)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WorkerLocation, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WorkerLocation, Release)
|
||||
|
||||
/* static */ already_AddRefed<WorkerLocation>
|
||||
WorkerLocation::Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
||||
WorkerPrivate::LocationInfo& aInfo)
|
||||
{
|
||||
nsRefPtr<WorkerLocation> location =
|
||||
new WorkerLocation(NS_ConvertUTF8toUTF16(aInfo.mHref),
|
||||
new WorkerLocation(aCx,
|
||||
NS_ConvertUTF8toUTF16(aInfo.mHref),
|
||||
NS_ConvertUTF8toUTF16(aInfo.mProtocol),
|
||||
NS_ConvertUTF8toUTF16(aInfo.mHost),
|
||||
NS_ConvertUTF8toUTF16(aInfo.mHostname),
|
||||
@ -31,13 +26,23 @@ WorkerLocation::Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
||||
NS_ConvertUTF8toUTF16(aInfo.mSearch),
|
||||
NS_ConvertUTF8toUTF16(aInfo.mHash));
|
||||
|
||||
if (!Wrap(aCx, aGlobal, location)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return location.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
WorkerLocation::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
void
|
||||
WorkerLocation::_trace(JSTracer* aTrc)
|
||||
{
|
||||
return WorkerLocationBinding_workers::Wrap(aCx, aScope, this);
|
||||
DOMBindingBase::_trace(aTrc);
|
||||
}
|
||||
|
||||
void
|
||||
WorkerLocation::_finalize(JSFreeOp* aFop)
|
||||
{
|
||||
DOMBindingBase::_finalize(aFop);
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
@ -7,12 +7,12 @@
|
||||
#define mozilla_dom_workers_location_h__
|
||||
|
||||
#include "Workers.h"
|
||||
#include "DOMBindingBase.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class WorkerLocation MOZ_FINAL : public nsWrapperCache
|
||||
class WorkerLocation MOZ_FINAL : public DOMBindingBase
|
||||
{
|
||||
nsString mHref;
|
||||
nsString mProtocol;
|
||||
@ -23,7 +23,8 @@ class WorkerLocation MOZ_FINAL : public nsWrapperCache
|
||||
nsString mSearch;
|
||||
nsString mHash;
|
||||
|
||||
WorkerLocation(const nsAString& aHref,
|
||||
WorkerLocation(JSContext* aCx,
|
||||
const nsAString& aHref,
|
||||
const nsAString& aProtocol,
|
||||
const nsAString& aHost,
|
||||
const nsAString& aHostname,
|
||||
@ -31,7 +32,8 @@ class WorkerLocation MOZ_FINAL : public nsWrapperCache
|
||||
const nsAString& aPathname,
|
||||
const nsAString& aSearch,
|
||||
const nsAString& aHash)
|
||||
: mHref(aHref)
|
||||
: DOMBindingBase(aCx)
|
||||
, mHref(aHref)
|
||||
, mProtocol(aProtocol)
|
||||
, mHost(aHost)
|
||||
, mHostname(aHostname)
|
||||
@ -40,29 +42,23 @@ class WorkerLocation MOZ_FINAL : public nsWrapperCache
|
||||
, mSearch(aSearch)
|
||||
, mHash(aHash)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WorkerLocation);
|
||||
SetIsDOMBinding();
|
||||
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerLocation);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation)
|
||||
|
||||
static already_AddRefed<WorkerLocation>
|
||||
Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
||||
WorkerPrivate::LocationInfo& aInfo);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
virtual void
|
||||
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
|
||||
|
||||
nsISupports* GetParentObject() const {
|
||||
return nullptr;
|
||||
}
|
||||
virtual void
|
||||
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
||||
|
||||
~WorkerLocation()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WorkerLocation);
|
||||
MOZ_COUNT_DTOR(mozilla::dom::workers::WorkerLocation);
|
||||
}
|
||||
|
||||
void Stringify(nsString& aHref) const
|
||||
@ -101,6 +97,7 @@ public:
|
||||
{
|
||||
aHash = mHash;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
@ -7,15 +7,9 @@
|
||||
|
||||
#include "DOMBindingInlines.h"
|
||||
#include "RuntimeService.h"
|
||||
#include "mozilla/dom/WorkerNavigatorBinding.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerNavigator)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WorkerNavigator, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WorkerNavigator, Release)
|
||||
|
||||
/* static */ already_AddRefed<WorkerNavigator>
|
||||
WorkerNavigator::Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
{
|
||||
@ -26,16 +20,26 @@ WorkerNavigator::Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
rts->GetNavigatorStrings();
|
||||
|
||||
nsRefPtr<WorkerNavigator> navigator =
|
||||
new WorkerNavigator(strings.mAppName, strings.mAppVersion,
|
||||
new WorkerNavigator(aCx, strings.mAppName, strings.mAppVersion,
|
||||
strings.mPlatform, strings.mUserAgent);
|
||||
|
||||
if (!Wrap(aCx, aGlobal, navigator)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return navigator.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
WorkerNavigator::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
void
|
||||
WorkerNavigator::_trace(JSTracer* aTrc)
|
||||
{
|
||||
return WorkerNavigatorBinding_workers::Wrap(aCx, aScope, this);
|
||||
DOMBindingBase::_trace(aTrc);
|
||||
}
|
||||
|
||||
void
|
||||
WorkerNavigator::_finalize(JSFreeOp* aFop)
|
||||
{
|
||||
DOMBindingBase::_finalize(aFop);
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
@ -7,49 +7,45 @@
|
||||
#define mozilla_dom_workers_navigator_h__
|
||||
|
||||
#include "Workers.h"
|
||||
#include "mozilla/dom/workers/bindings/DOMBindingBase.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class WorkerNavigator MOZ_FINAL : public nsWrapperCache
|
||||
class WorkerNavigator MOZ_FINAL : public DOMBindingBase
|
||||
{
|
||||
nsString mAppName;
|
||||
nsString mAppVersion;
|
||||
nsString mPlatform;
|
||||
nsString mUserAgent;
|
||||
|
||||
WorkerNavigator(const nsAString& aAppName,
|
||||
WorkerNavigator(JSContext* aCx,
|
||||
const nsAString& aAppName,
|
||||
const nsAString& aAppVersion,
|
||||
const nsAString& aPlatform,
|
||||
const nsAString& aUserAgent)
|
||||
: mAppName(aAppName)
|
||||
: DOMBindingBase(aCx)
|
||||
, mAppName(aAppName)
|
||||
, mAppVersion(aAppVersion)
|
||||
, mPlatform(aPlatform)
|
||||
, mUserAgent(aUserAgent)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WorkerNavigator);
|
||||
SetIsDOMBinding();
|
||||
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerNavigator);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerNavigator)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerNavigator)
|
||||
|
||||
static already_AddRefed<WorkerNavigator>
|
||||
Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
virtual void
|
||||
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
|
||||
|
||||
nsISupports* GetParentObject() const {
|
||||
return nullptr;
|
||||
}
|
||||
virtual void
|
||||
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
||||
|
||||
~WorkerNavigator()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WorkerNavigator);
|
||||
MOZ_COUNT_DTOR(mozilla::dom::workers::WorkerNavigator);
|
||||
}
|
||||
|
||||
void GetAppName(nsString& aAppName) const
|
||||
@ -68,8 +64,8 @@ public:
|
||||
{
|
||||
aUserAgent = mUserAgent;
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
END_WORKERS_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_workers_navigator_h__
|
||||
|
@ -268,12 +268,7 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!WrapNewBindingObject(aCx, obj, location, &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scope->mSlots[SLOT_location] = val;
|
||||
scope->mSlots[SLOT_location] = OBJECT_TO_JSVAL(location->GetJSObject());
|
||||
}
|
||||
|
||||
aArgs.rval().set(scope->mSlots[SLOT_location]);
|
||||
@ -423,12 +418,7 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!WrapNewBindingObject(aCx, obj, navigator, &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scope->mSlots[SLOT_navigator] = val;
|
||||
scope->mSlots[SLOT_navigator] = OBJECT_TO_JSVAL(navigator->GetJSObject());
|
||||
}
|
||||
|
||||
aArgs.rval().set(scope->mSlots[SLOT_navigator]);
|
||||
|
Loading…
Reference in New Issue
Block a user