Merge mozilla-inbound to mozilla-central. a=merge

This commit is contained in:
Andreea Pavel 2018-08-27 00:48:20 +03:00
commit cd881b0a1a
30 changed files with 296 additions and 197 deletions

View file

@ -101,7 +101,7 @@ skip-if = (verify && !debug && (os == 'win'))
[browser_bug416661.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug417483.js]
skip-if = (verify && debug && (os == 'mac'))
skip-if = (verify && debug && (os == 'mac')) || (os == 'mac') || (os == 'linux') #Bug 1444703
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug419612.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.

View file

@ -58,8 +58,8 @@ var gTests = [
await closeStream();
// TODO(Bug 1304997): Fix the race in closeStream() and remove this
// promiseWaitForCondition().
await promiseWaitForCondition(() => !tab.getAttribute("sharing"));
// TestUtils.waitForCondition().
await TestUtils.waitForCondition(() => !tab.getAttribute("sharing"));
is(tab.getAttribute("sharing"), "",
"the tab no longer has the 'sharing' attribute after closing the stream");
}

View file

@ -12,14 +12,63 @@
namespace mozilla {
namespace dom {
// AbortSignalImpl
// ----------------------------------------------------------------------------
AbortSignalImpl::AbortSignalImpl(bool aAborted)
: mAborted(aAborted)
{}
bool
AbortSignalImpl::Aborted() const
{
return mAborted;
}
void
AbortSignalImpl::Abort()
{
if (mAborted) {
return;
}
mAborted = true;
// Let's inform the followers.
for (AbortFollower* follower : mFollowers) {
follower->Abort();
}
}
void
AbortSignalImpl::AddFollower(AbortFollower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
if (!mFollowers.Contains(aFollower)) {
mFollowers.AppendElement(aFollower);
}
}
void
AbortSignalImpl::RemoveFollower(AbortFollower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
mFollowers.RemoveElement(aFollower);
}
// AbortSignal
// ----------------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_CLASS(AbortSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFollowingSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFollowingSignal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AbortSignal)
@ -31,11 +80,7 @@ NS_IMPL_RELEASE_INHERITED(AbortSignal, DOMEventTargetHelper)
AbortSignal::AbortSignal(nsIGlobalObject* aGlobalObject,
bool aAborted)
: DOMEventTargetHelper(aGlobalObject)
, mAborted(aAborted)
{}
AbortSignal::AbortSignal(bool aAborted)
: mAborted(aAborted)
, AbortSignalImpl(aAborted)
{}
JSObject*
@ -44,22 +89,10 @@ AbortSignal::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return AbortSignal_Binding::Wrap(aCx, this, aGivenProto);
}
bool
AbortSignal::Aborted() const
{
return mAborted;
}
void
AbortSignal::Abort()
{
MOZ_ASSERT(!mAborted);
mAborted = true;
// Let's inform the followers.
for (uint32_t i = 0; i < mFollowers.Length(); ++i) {
mFollowers[i]->Abort();
}
AbortSignalImpl::Abort();
EventInit init;
init.mBubbles = false;
@ -72,22 +105,6 @@ AbortSignal::Abort()
DispatchEvent(*event);
}
void
AbortSignal::AddFollower(AbortFollower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
if (!mFollowers.Contains(aFollower)) {
mFollowers.AppendElement(aFollower);
}
}
void
AbortSignal::RemoveFollower(AbortFollower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
mFollowers.RemoveElement(aFollower);
}
// AbortFollower
// ----------------------------------------------------------------------------
@ -97,7 +114,7 @@ AbortFollower::~AbortFollower()
}
void
AbortFollower::Follow(AbortSignal* aSignal)
AbortFollower::Follow(AbortSignalImpl* aSignal)
{
MOZ_DIAGNOSTIC_ASSERT(aSignal);

View file

@ -13,15 +13,17 @@ namespace mozilla {
namespace dom {
class AbortSignal;
class AbortSignalImpl;
// This class must be implemented by objects who want to follow a AbortSignal.
// This class must be implemented by objects who want to follow a
// AbortSignalImpl.
class AbortFollower
{
public:
virtual void Abort() = 0;
void
Follow(AbortSignal* aSignal);
Follow(AbortSignalImpl* aSignal);
void
Unfollow();
@ -32,21 +34,16 @@ public:
protected:
virtual ~AbortFollower();
RefPtr<AbortSignal> mFollowingSignal;
// Subclasses of AbortFollower must Traverse/Unlink this member.
RefPtr<AbortSignalImpl> mFollowingSignal;
};
class AbortSignal final : public DOMEventTargetHelper
, public AbortFollower
// Any subclass of this class must Traverse/Unlink mFollowingSignal.
class AbortSignalImpl : public AbortFollower
, public nsISupports
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AbortSignal, DOMEventTargetHelper)
AbortSignal(nsIGlobalObject* aGlobalObject, bool aAborted);
explicit AbortSignal(bool aAborted);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
explicit AbortSignalImpl(bool aAborted);
bool
Aborted() const;
@ -54,23 +51,43 @@ public:
void
Abort() override;
IMPL_EVENT_HANDLER(abort);
void
AddFollower(AbortFollower* aFollower);
void
RemoveFollower(AbortFollower* aFollower);
private:
~AbortSignal() = default;
protected:
virtual ~AbortSignalImpl() = default;
private:
// Raw pointers. AbortFollower unregisters itself in the DTOR.
nsTArray<AbortFollower*> mFollowers;
bool mAborted;
};
class AbortSignal final : public DOMEventTargetHelper
, public AbortSignalImpl
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AbortSignal, DOMEventTargetHelper)
AbortSignal(nsIGlobalObject* aGlobalObject, bool aAborted);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
IMPL_EVENT_HANDLER(abort);
void
Abort() override;
private:
~AbortSignal() = default;
};
} // dom namespace
} // mozilla namespace

View file

@ -74,21 +74,44 @@ AbortStream(JSContext* aCx, JS::Handle<JSObject*> aStream)
} // anonymous
// This class helps the proxying of AbortSignal changes cross threads.
class AbortSignalMainThread final : public AbortSignalImpl
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(AbortSignalMainThread)
explicit AbortSignalMainThread(bool aAborted)
: AbortSignalImpl(aAborted)
{}
private:
~AbortSignalMainThread() = default;
};
NS_IMPL_CYCLE_COLLECTION(AbortSignalMainThread, mFollowingSignal)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AbortSignalMainThread)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(AbortSignalMainThread)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AbortSignalMainThread)
// This class helps the proxying of AbortSignalImpl changes cross threads.
class AbortSignalProxy final : public AbortFollower
{
// This is created and released on the main-thread.
RefPtr<AbortSignal> mSignalMainThread;
RefPtr<AbortSignalImpl> mSignalImplMainThread;
// The main-thread event target for runnable dispatching.
nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
// This value is used only for the creation of AbortSignal on the
// This value is used only for the creation of AbortSignalImpl on the
// main-thread. They are not updated.
const bool mAborted;
// This runnable propagates changes from the AbortSignal on workers to the
// AbortSignal on main-thread.
// This runnable propagates changes from the AbortSignalImpl on workers to the
// AbortSignalImpl on main-thread.
class AbortSignalProxyRunnable final : public Runnable
{
RefPtr<AbortSignalProxy> mProxy;
@ -103,8 +126,9 @@ class AbortSignalProxy final : public AbortFollower
Run() override
{
MOZ_ASSERT(NS_IsMainThread());
AbortSignal* signal = mProxy->GetOrCreateSignalForMainThread();
signal->Abort();
AbortSignalImpl* signalImpl =
mProxy->GetOrCreateSignalImplForMainThread();
signalImpl->Abort();
return NS_OK;
}
};
@ -112,12 +136,13 @@ class AbortSignalProxy final : public AbortFollower
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AbortSignalProxy)
AbortSignalProxy(AbortSignal* aSignal, nsIEventTarget* aMainThreadEventTarget)
AbortSignalProxy(AbortSignalImpl* aSignalImpl,
nsIEventTarget* aMainThreadEventTarget)
: mMainThreadEventTarget(aMainThreadEventTarget)
, mAborted(aSignal->Aborted())
, mAborted(aSignalImpl->Aborted())
{
MOZ_ASSERT(mMainThreadEventTarget);
Follow(aSignal);
Follow(aSignalImpl);
}
void
@ -128,18 +153,18 @@ public:
mMainThreadEventTarget->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
}
AbortSignal*
GetOrCreateSignalForMainThread()
AbortSignalImpl*
GetOrCreateSignalImplForMainThread()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mSignalMainThread) {
mSignalMainThread = new AbortSignal(mAborted);
if (!mSignalImplMainThread) {
mSignalImplMainThread = new AbortSignalMainThread(mAborted);
}
return mSignalMainThread;
return mSignalImplMainThread;
}
AbortSignal*
GetSignalForTargetThread()
AbortSignalImpl*
GetSignalImplForTargetThread()
{
return mFollowingSignal;
}
@ -154,8 +179,8 @@ private:
~AbortSignalProxy()
{
NS_ProxyRelease(
"AbortSignalProxy::mSignalMainThread",
mMainThreadEventTarget, mSignalMainThread.forget());
"AbortSignalProxy::mSignalImplMainThread",
mMainThreadEventTarget, mSignalImplMainThread.forget());
}
};
@ -173,7 +198,7 @@ public:
// Returns null if worker is shutting down.
static already_AddRefed<WorkerFetchResolver>
Create(WorkerPrivate* aWorkerPrivate, Promise* aPromise,
AbortSignal* aSignal, FetchObserver* aObserver)
AbortSignalImpl* aSignalImpl, FetchObserver* aObserver)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
@ -184,9 +209,10 @@ public:
}
RefPtr<AbortSignalProxy> signalProxy;
if (aSignal) {
if (aSignalImpl) {
signalProxy =
new AbortSignalProxy(aSignal, aWorkerPrivate->MainThreadEventTarget());
new AbortSignalProxy(aSignalImpl,
aWorkerPrivate->MainThreadEventTarget());
}
RefPtr<WorkerFetchResolver> r =
@ -205,7 +231,7 @@ public:
return r.forget();
}
AbortSignal*
AbortSignalImpl*
GetAbortSignalForMainThread()
{
MOZ_ASSERT(NS_IsMainThread());
@ -214,10 +240,10 @@ public:
return nullptr;
}
return mSignalProxy->GetOrCreateSignalForMainThread();
return mSignalProxy->GetOrCreateSignalImplForMainThread();
}
AbortSignal*
AbortSignalImpl*
GetAbortSignalForTargetThread()
{
mPromiseProxy->GetWorkerPrivate()->AssertIsOnWorkerThread();
@ -226,7 +252,7 @@ public:
return nullptr;
}
return mSignalProxy->GetSignalForTargetThread();
return mSignalProxy->GetSignalImplForTargetThread();
}
PromiseWorkerProxy*
@ -307,7 +333,7 @@ class MainThreadFetchResolver final : public FetchDriverObserver
RefPtr<Promise> mPromise;
RefPtr<Response> mResponse;
RefPtr<FetchObserver> mFetchObserver;
RefPtr<AbortSignal> mSignal;
RefPtr<AbortSignalImpl> mSignalImpl;
const bool mMozErrors;
nsCOMPtr<nsILoadGroup> mLoadGroup;
@ -315,10 +341,10 @@ class MainThreadFetchResolver final : public FetchDriverObserver
NS_DECL_OWNINGTHREAD
public:
MainThreadFetchResolver(Promise* aPromise, FetchObserver* aObserver,
AbortSignal* aSignal, bool aMozErrors)
AbortSignalImpl* aSignalImpl, bool aMozErrors)
: mPromise(aPromise)
, mFetchObserver(aObserver)
, mSignal(aSignal)
, mSignalImpl(aSignalImpl)
, mMozErrors(aMozErrors)
{}
@ -415,11 +441,12 @@ public:
fetch->SetController(mController);
}
RefPtr<AbortSignal> signal = mResolver->GetAbortSignalForMainThread();
RefPtr<AbortSignalImpl> signalImpl =
mResolver->GetAbortSignalForMainThread();
// ...but release it before calling Fetch, because mResolver's callback can
// be called synchronously and they want the mutex, too.
return fetch->Fetch(signal, mResolver);
return fetch->Fetch(signalImpl, mResolver);
}
};
@ -456,9 +483,9 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
}
RefPtr<InternalRequest> r = request->GetInternalRequest();
RefPtr<AbortSignal> signal = request->GetSignal();
RefPtr<AbortSignalImpl> signalImpl = request->GetSignalImpl();
if (signal && signal->Aborted()) {
if (signalImpl && signalImpl->Aborted()) {
// Already aborted signal rejects immediately.
aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
return nullptr;
@ -466,7 +493,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
RefPtr<FetchObserver> observer;
if (aInit.mObserve.WasPassed()) {
observer = new FetchObserver(aGlobal, signal);
observer = new FetchObserver(aGlobal, signalImpl);
aInit.mObserve.Value().HandleEvent(*observer);
}
@ -505,7 +532,8 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
Telemetry::Accumulate(Telemetry::FETCH_IS_MAINTHREAD, 1);
RefPtr<MainThreadFetchResolver> resolver =
new MainThreadFetchResolver(p, observer, signal, request->MozErrors());
new MainThreadFetchResolver(p, observer, signalImpl,
request->MozErrors());
RefPtr<FetchDriver> fetch =
new FetchDriver(r, principal, loadGroup,
aGlobal->EventTargetFor(TaskCategory::Other),
@ -513,7 +541,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
isTrackingFetch);
fetch->SetDocument(doc);
resolver->SetLoadGroup(loadGroup);
aRv = fetch->Fetch(signal, resolver);
aRv = fetch->Fetch(signalImpl, resolver);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -528,7 +556,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
}
RefPtr<WorkerFetchResolver> resolver =
WorkerFetchResolver::Create(worker, p, signal, observer);
WorkerFetchResolver::Create(worker, p, signalImpl, observer);
if (!resolver) {
NS_WARNING("Could not keep the worker alive.");
aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
@ -562,7 +590,7 @@ MainThreadFetchResolver::OnResponseAvailableInternal(InternalResponse* aResponse
}
nsCOMPtr<nsIGlobalObject> go = mPromise->GetParentObject();
mResponse = new Response(go, aResponse, mSignal);
mResponse = new Response(go, aResponse, mSignalImpl);
mPromise->MaybeResolve(mResponse);
} else {
if (mFetchObserver) {
@ -1150,8 +1178,8 @@ already_AddRefed<Promise>
FetchBody<Derived>::ConsumeBody(JSContext* aCx, FetchConsumeType aType,
ErrorResult& aRv)
{
RefPtr<AbortSignal> signal = DerivedClass()->GetSignal();
if (signal && signal->Aborted()) {
RefPtr<AbortSignalImpl> signalImpl = DerivedClass()->GetSignalImpl();
if (signalImpl && signalImpl->Aborted()) {
aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
return nullptr;
}
@ -1170,7 +1198,7 @@ FetchBody<Derived>::ConsumeBody(JSContext* aCx, FetchConsumeType aType,
RefPtr<Promise> promise =
FetchBodyConsumer<Derived>::Create(global, mMainThreadEventTarget, this,
signal, aType, aRv);
signalImpl, aType, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -1224,17 +1252,17 @@ FetchBody<Derived>::SetReadableStreamBody(JSContext* aCx, JSObject* aBody)
MOZ_ASSERT(aBody);
mReadableStreamBody = aBody;
RefPtr<AbortSignal> signal = DerivedClass()->GetSignal();
if (!signal) {
RefPtr<AbortSignalImpl> signalImpl = DerivedClass()->GetSignalImpl();
if (!signalImpl) {
return;
}
bool aborted = signal->Aborted();
bool aborted = signalImpl->Aborted();
if (aborted) {
JS::Rooted<JSObject*> body(aCx, mReadableStreamBody);
AbortStream(aCx, body);
} else if (!IsFollowing()) {
Follow(signal);
Follow(signalImpl);
}
}
@ -1282,12 +1310,12 @@ FetchBody<Derived>::GetBody(JSContext* aCx,
}
}
RefPtr<AbortSignal> signal = DerivedClass()->GetSignal();
if (signal) {
if (signal->Aborted()) {
RefPtr<AbortSignalImpl> signalImpl = DerivedClass()->GetSignalImpl();
if (signalImpl) {
if (signalImpl->Aborted()) {
AbortStream(aCx, body);
} else if (!IsFollowing()) {
Follow(signal);
Follow(signalImpl);
}
}

View file

@ -249,8 +249,8 @@ public:
mBodyUsed = true;
}
virtual AbortSignal*
GetSignal() const = 0;
virtual AbortSignalImpl*
GetSignalImpl() const = 0;
// AbortFollower
void

View file

@ -338,7 +338,7 @@ template <class Derived>
FetchBodyConsumer<Derived>::Create(nsIGlobalObject* aGlobal,
nsIEventTarget* aMainThreadEventTarget,
FetchBody<Derived>* aBody,
AbortSignal* aSignal,
AbortSignalImpl* aSignalImpl,
FetchConsumeType aType,
ErrorResult& aRv)
{
@ -406,8 +406,8 @@ FetchBodyConsumer<Derived>::Create(nsIGlobalObject* aGlobal,
return nullptr;
}
if (aSignal) {
consumer->Follow(aSignal);
if (aSignalImpl) {
consumer->Follow(aSignalImpl);
}
return promise.forget();

View file

@ -39,7 +39,7 @@ public:
Create(nsIGlobalObject* aGlobal,
nsIEventTarget* aMainThreadEventTarget,
FetchBody<Derived>* aBody,
AbortSignal* aSignal,
AbortSignalImpl* aSignalImpl,
FetchConsumeType aType,
ErrorResult& aRv);

View file

@ -362,7 +362,7 @@ FetchDriver::~FetchDriver()
}
nsresult
FetchDriver::Fetch(AbortSignal* aSignal, FetchDriverObserver* aObserver)
FetchDriver::Fetch(AbortSignalImpl* aSignalImpl, FetchDriverObserver* aObserver)
{
AssertIsOnMainThread();
#ifdef DEBUG
@ -391,13 +391,13 @@ FetchDriver::Fetch(AbortSignal* aSignal, FetchDriverObserver* aObserver)
// If the signal is aborted, it's time to inform the observer and terminate
// the operation.
if (aSignal) {
if (aSignal->Aborted()) {
if (aSignalImpl) {
if (aSignalImpl->Aborted()) {
Abort();
return NS_OK;
}
Follow(aSignal);
Follow(aSignalImpl);
}
rv = HttpFetch(mRequest->GetPreferredAlternativeDataType());

View file

@ -113,7 +113,7 @@ public:
PerformanceStorage* aPerformanceStorage,
bool aIsTrackingFetch);
nsresult Fetch(AbortSignal* aSignal,
nsresult Fetch(AbortSignalImpl* aSignalImpl,
FetchDriverObserver* aObserver);
void

View file

@ -27,12 +27,12 @@ NS_IMPL_ADDREF_INHERITED(FetchObserver, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(FetchObserver, DOMEventTargetHelper)
FetchObserver::FetchObserver(nsIGlobalObject* aGlobal,
AbortSignal* aSignal)
AbortSignalImpl* aSignalImpl)
: DOMEventTargetHelper(aGlobal)
, mState(FetchState::Requesting)
{
if (aSignal) {
Follow(aSignal);
if (aSignalImpl) {
Follow(aSignalImpl);
}
}

View file

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchObserver, DOMEventTargetHelper)
FetchObserver(nsIGlobalObject* aGlobal, AbortSignal* aSignal);
FetchObserver(nsIGlobalObject* aGlobal, AbortSignalImpl* aSignalImpl);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

View file

@ -64,7 +64,7 @@ Request::Request(nsIGlobalObject* aOwner, InternalRequest* aRequest,
if (aSignal) {
// If we don't have a signal as argument, we will create it when required by
// content, otherwise the Request's signal must follow what has been passed.
mSignal = new AbortSignal(aSignal->Aborted());
mSignal = new AbortSignal(aOwner, aSignal->Aborted());
if (!mSignal->Aborted()) {
mSignal->Follow(aSignal);
}
@ -626,14 +626,14 @@ AbortSignal*
Request::GetOrCreateSignal()
{
if (!mSignal) {
mSignal = new AbortSignal(false);
mSignal = new AbortSignal(mOwner, false);
}
return mSignal;
}
AbortSignal*
Request::GetSignal() const
AbortSignalImpl*
Request::GetSignalImpl() const
{
return mSignal;
}

View file

@ -167,9 +167,9 @@ public:
AbortSignal*
GetOrCreateSignal();
// This can return a null AbortSignal.
AbortSignal*
GetSignal() const override;
// This can return a null AbortSignalImpl.
AbortSignalImpl*
GetSignalImpl() const override;
private:
~Request();

View file

@ -37,7 +37,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(Response)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Response)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHeaders)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSignal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSignalImpl)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFetchStreamReader)
tmp->mReadableStreamBody = nullptr;
@ -49,7 +49,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Response)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHeaders)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSignalImpl)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFetchStreamReader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -66,10 +66,10 @@ NS_INTERFACE_MAP_END
Response::Response(nsIGlobalObject* aGlobal,
InternalResponse* aInternalResponse,
AbortSignal* aSignal)
AbortSignalImpl* aSignalImpl)
: FetchBody<Response>(aGlobal)
, mInternalResponse(aInternalResponse)
, mSignal(aSignal)
, mSignalImpl(aSignalImpl)
{
MOZ_ASSERT(aInternalResponse->Headers()->Guard() == HeadersGuardEnum::Immutable ||
aInternalResponse->Headers()->Guard() == HeadersGuardEnum::Response);
@ -344,7 +344,7 @@ Response::Clone(JSContext* aCx, ErrorResult& aRv)
? InternalResponse::eDontCloneInputStream
: InternalResponse::eCloneInputStream);
RefPtr<Response> response = new Response(mOwner, ir, mSignal);
RefPtr<Response> response = new Response(mOwner, ir, GetSignalImpl());
if (body) {
// Maybe we have a body, but we receive null from MaybeTeeReadableStreamBody
@ -387,7 +387,7 @@ Response::CloneUnfiltered(JSContext* aCx, ErrorResult& aRv)
: InternalResponse::eCloneInputStream);
RefPtr<InternalResponse> ir = clone->Unfiltered();
RefPtr<Response> ref = new Response(mOwner, ir, mSignal);
RefPtr<Response> ref = new Response(mOwner, ir, GetSignalImpl());
if (body) {
// Maybe we have a body, but we receive null from MaybeTeeReadableStreamBody

View file

@ -34,7 +34,7 @@ class Response final : public nsISupports
public:
Response(nsIGlobalObject* aGlobal, InternalResponse* aInternalResponse,
AbortSignal* aSignal);
AbortSignalImpl* aSignalImpl);
Response(const Response& aOther) = delete;
@ -140,10 +140,10 @@ public:
already_AddRefed<InternalResponse>
GetInternalResponse() const;
AbortSignal*
GetSignal() const override
AbortSignalImpl*
GetSignalImpl() const override
{
return mSignal;
return mSignalImpl;
}
private:
@ -152,7 +152,7 @@ private:
RefPtr<InternalResponse> mInternalResponse;
// Lazily created
RefPtr<Headers> mHeaders;
RefPtr<AbortSignal> mSignal;
RefPtr<AbortSignalImpl> mSignalImpl;
};
} // namespace dom

View file

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The audioipc-2 git repository is: https://github.com/djg/audioipc-2.git
The git commit ID used was 219a811b62b83bd6e4cb54ae6aebc56bbb43203c (2018-04-18 13:57:59 +1200)
The git commit ID used was 3d716fe897ccb3ea43a2af0c794ea57c433400d7 (2018-07-30 08:51:04 +1200)

View file

@ -108,6 +108,8 @@ impl ControlMsgBuilder {
let cmsghdr = cmsghdr {
cmsg_len: cmsg_len as _,
#[cfg(target_env = "musl")]
__pad1: 0,
cmsg_level: level,
cmsg_type: kind,
};

View file

@ -53,8 +53,8 @@ pub struct ClientStream<'ctx> {
}
struct CallbackServer {
input_shm: SharedMemSlice,
output_shm: SharedMemMutSlice,
input_shm: Option<SharedMemSlice>,
output_shm: Option<SharedMemMutSlice>,
data_cb: ffi::cubeb_data_callback,
state_cb: ffi::cubeb_state_callback,
user_ptr: usize,
@ -77,21 +77,33 @@ impl rpc::Server for CallbackServer {
);
// Clone values that need to be moved into the cpu pool thread.
let input_shm = unsafe { self.input_shm.clone_view() };
let mut output_shm = unsafe { self.output_shm.clone_view() };
let input_shm = match self.input_shm {
Some(ref shm) => unsafe { Some(shm.clone_view()) },
None => None,
};
let mut output_shm = match self.output_shm {
Some(ref shm) => unsafe { Some(shm.clone_view()) },
None => None,
};
let user_ptr = self.user_ptr;
let cb = self.data_cb.unwrap();
self.cpu_pool.spawn_fn(move || {
// TODO: This is proof-of-concept. Make it better.
let input_ptr: *const u8 = input_shm
.get_slice(nframes as usize * frame_size)
.unwrap()
.as_ptr();
let output_ptr: *mut u8 = output_shm
.get_mut_slice(nframes as usize * frame_size)
.unwrap()
.as_mut_ptr();
let input_ptr: *const u8 = match input_shm {
Some(shm) => shm
.get_slice(nframes as usize * frame_size)
.unwrap()
.as_ptr(),
None => ptr::null()
};
let output_ptr: *mut u8 = match output_shm {
Some(ref mut shm) => shm
.get_mut_slice(nframes as usize * frame_size)
.unwrap()
.as_mut_ptr(),
None => ptr::null_mut()
};
set_in_callback(true);
let nframes = unsafe {
@ -136,6 +148,9 @@ impl<'ctx> ClientStream<'ctx> {
) -> Result<Stream> {
assert_not_in_callback();
let has_input = init_params.input_stream_params.is_some();
let has_output = init_params.output_stream_params.is_some();
let rpc = ctx.rpc();
let data = try!(send_recv!(rpc, StreamInit(init_params) => StreamCreated()));
@ -146,11 +161,19 @@ impl<'ctx> ClientStream<'ctx> {
let input = data.fds[1];
let input_file = unsafe { File::from_raw_fd(input) };
let input_shm = SharedMemSlice::from(&input_file, SHM_AREA_SIZE).unwrap();
let input_shm = if has_input {
Some(SharedMemSlice::from(&input_file, SHM_AREA_SIZE).unwrap())
} else {
None
};
let output = data.fds[2];
let output_file = unsafe { File::from_raw_fd(output) };
let output_shm = SharedMemMutSlice::from(&output_file, SHM_AREA_SIZE).unwrap();
let output_shm = if has_output {
Some(SharedMemMutSlice::from(&output_file, SHM_AREA_SIZE).unwrap())
} else {
None
};
let user_data = user_ptr as usize;

View file

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The cubeb-pulse-rs git repository is: https://github.com/djg/cubeb-pulse-rs.git
The git commit ID used was d0bdf51ebd0a653cc4276d2346db852a3060ade0 (2018-06-29 10:09:52 +1000)
The git commit ID used was 798864774d7b9e65e8327ba87a753254afa3da6e (2018-07-24 14:13:11 +1000)

View file

@ -486,7 +486,9 @@ impl ContextOps for PulseContext {
fn success(_: &pulse::Context, success: i32, user_data: *mut c_void) {
let ctx = unsafe { &*(user_data as *mut PulseContext) };
debug_assert_ne!(success, 0);
if success != 1 {
cubeb_log!("subscribe_success ignored failure: {}", success);
}
ctx.mainloop.signal();
}

View file

@ -902,13 +902,17 @@ impl<'ctx> PulseStream<'ctx> {
fn stream_success(_: &pulse::Stream, success: i32, u: *mut c_void) {
let stm = unsafe { &*(u as *mut PulseStream) };
debug_assert_ne!(success, 0);
if success != 1 {
cubeb_log!("stream_success ignored failure: {}", success);
}
stm.context.mainloop.signal();
}
fn context_success(_: &pulse::Context, success: i32, u: *mut c_void) {
let ctx = unsafe { &*(u as *mut PulseContext) };
debug_assert_ne!(success, 0);
if success != 1 {
cubeb_log!("context_success ignored failure: {}", success);
}
ctx.mainloop.signal();
}

View file

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The nestegg git repository is: https://github.com/kinetiknz/nestegg
The git commit ID used was 89ed0daf2edccb25f744e5faff88b8b4684adceb.
The git commit ID used was 7bafcb950eb0a8fa66858a6f272886f6b3ef40af (2018-08-09 16:39:37 +1200)

View file

@ -187,7 +187,7 @@ void nestegg_destroy(nestegg * context);
int nestegg_duration(nestegg * context, uint64_t * duration);
/** Query the tstamp scale of the media stream in nanoseconds.
@note Timecodes presented by nestegg have been scaled by this value
@note Timestamps presented by nestegg have been scaled by this value
before presentation to the caller.
@param context Stream context initialized by #nestegg_init.
@param scale Storage for the queried scale factor.
@ -366,7 +366,7 @@ int nestegg_packet_has_keyframe(nestegg_packet * packet);
@retval -1 Error. */
int nestegg_packet_track(nestegg_packet * packet, unsigned int * track);
/** Query the time stamp in nanoseconds of @a packet.
/** Query the timestamp in nanoseconds of @a packet.
@param packet Packet initialized by #nestegg_read_packet.
@param tstamp Storage for the queried timestamp in nanoseconds.
@retval 0 Success.

View file

@ -1052,9 +1052,9 @@ ne_read_simple(nestegg * ctx, struct ebml_element_desc * desc, size_t length)
storage = (struct ebml_type *) (ctx->ancestor->data + desc->offset);
if (storage->read) {
ctx->log(ctx, NESTEGG_LOG_DEBUG, "element %llx (%s) already read, skipping",
desc->id, desc->name);
return 0;
ctx->log(ctx, NESTEGG_LOG_DEBUG, "element %llx (%s) already read, skipping %u",
desc->id, desc->name, length);
return ne_io_read_skip(ctx->io, length);
}
storage->type = desc->type;
@ -1642,6 +1642,11 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
} else {
encryption_size = 0;
}
if (encryption_size > frame_sizes[i]) {
ne_free_frame(f);
nestegg_free_packet(pkt);
return -1;
}
data_size = frame_sizes[i] - encryption_size;
/* Encryption parsed */
f->data = ne_alloc(data_size);
@ -1955,17 +1960,18 @@ static int
ne_buffer_read(void * buffer, size_t length, void * userdata)
{
struct io_buffer * iob = userdata;
int rv = 1;
size_t available = iob->length - iob->offset;
if (available < length)
if (available == 0)
return 0;
if (available < length)
return -1;
memcpy(buffer, iob->buffer + iob->offset, length);
iob->offset += length;
return rv;
return 1;
}
static int
@ -2074,6 +2080,17 @@ ne_match_webm(nestegg_io io, int64_t max_offset)
return 1;
}
static void
ne_free_block_additions(struct block_additional * block_additional)
{
while (block_additional) {
struct block_additional * tmp = block_additional;
block_additional = block_additional->next;
free(tmp->data);
free(tmp);
}
}
int
nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback, int64_t max_offset)
{
@ -2789,7 +2806,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
while (ne_io_tell(ctx->io) < block_group_end) {
r = ne_read_element(ctx, &id, &size);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2799,9 +2816,14 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
switch (id) {
case ID_BLOCK: {
if (*pkt) {
ctx->log(ctx, NESTEGG_LOG_DEBUG,
"read_packet: multiple Blocks in BlockGroup, dropping previously read Block");
nestegg_free_packet(*pkt);
}
r = ne_read_block(ctx, id, size, pkt);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2815,7 +2837,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
case ID_BLOCK_DURATION: {
r = ne_read_uint(ctx->io, &block_duration, size);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2824,7 +2846,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
}
tc_scale = ne_get_timecode_scale(ctx);
if (tc_scale == 0) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2838,7 +2860,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
case ID_DISCARD_PADDING: {
r = ne_read_int(ctx->io, &discard_padding, size);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2851,7 +2873,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
case ID_BLOCK_ADDITIONS: {
/* There should only be one BlockAdditions; treat multiple as an error. */
if (block_additional) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2860,7 +2882,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
}
r = ne_read_block_additions(ctx, size, &block_additional);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2872,7 +2894,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
case ID_REFERENCE_BLOCK: {
r = ne_read_int(ctx->io, &reference_block, size);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2889,7 +2911,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
"read_packet: unknown element %llx in BlockGroup", id);
r = ne_io_read_skip(ctx->io, size);
if (r != 1) {
free(block_additional);
ne_free_block_additions(block_additional);
if (*pkt) {
nestegg_free_packet(*pkt);
*pkt = NULL;
@ -2913,7 +2935,7 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
predictive frames and no keyframes */
(*pkt)->keyframe = NESTEGG_PACKET_HAS_KEYFRAME_FALSE;
} else {
free(block_additional);
ne_free_block_additions(block_additional);
}
break;
}
@ -2932,7 +2954,6 @@ void
nestegg_free_packet(nestegg_packet * pkt)
{
struct frame * frame;
struct block_additional * block_additional;
while (pkt->frame) {
frame = pkt->frame;
@ -2941,12 +2962,7 @@ nestegg_free_packet(nestegg_packet * pkt)
ne_free_frame(frame);
}
while (pkt->block_additional) {
block_additional = pkt->block_additional;
pkt->block_additional = block_additional->next;
free(block_additional->data);
free(block_additional);
}
ne_free_block_additions(pkt->block_additional);
free(pkt);
}

View file

@ -6,6 +6,7 @@ cp $1/README.md .
cp $1/AUTHORS .
if [ -d $1/.git ]; then
rev=$(cd $1 && git rev-parse --verify HEAD)
date=$(cd $1 && git show -s --format=%ci HEAD)
dirty=$(cd $1 && git diff-index --name-only HEAD)
fi
@ -15,7 +16,8 @@ if [ -n "$rev" ]; then
version=$version-dirty
echo "WARNING: updating from a dirty git repository."
fi
sed -i "/The git commit ID used was/ s/[0-9a-f]\+\(-dirty\)\?\./$version./" README_MOZILLA
sed -i.bak -e "/The git commit ID used was/ s/[0-9a-f]\{40\}\(-dirty\)\{0,1\} .\{1,100\}/$version ($date)/" README_MOZILLA
rm README_MOZILLA.bak
else
echo "Remember to update README_MOZILLA with the version details."
fi

View file

@ -1618,7 +1618,7 @@
const label = tt.label || "";
const ttText = document.createTextNode(label);
const ttBtn = document.createXULElement("button");
const ttBtn = document.createElement("button");
ttBtn.classList.add("textTrackItem");
ttBtn.setAttribute("index", tt.index);

View file

@ -112,10 +112,6 @@ sidebarheader > label {
padding-inline-start: 4px;
}
.toolbar-focustarget {
-moz-user-focus: ignore !important;
}
toolbar[mode="text"] .toolbarbutton-text {
padding: 0 !important;
margin: 3px 5px !important;

View file

@ -218,10 +218,6 @@ label[disabled="true"] {
box-shadow: var(--focus-ring-box-shadow);
}
.toolbar-focustarget {
-moz-user-focus: ignore !important;
}
notification > button {
margin: 0 3px;
padding: 1px 10px;

View file

@ -122,10 +122,6 @@ sidebarheader > label {
padding-inline-start: 4px;
}
.toolbar-focustarget {
-moz-user-focus: ignore !important;
}
toolbar[mode="text"] .toolbarbutton-text {
padding: 0 !important;
margin: 3px 5px !important;