Merge inbound to mozilla-central a=merge

This commit is contained in:
arthur.iakab 2018-06-16 00:50:29 +03:00
commit fbbbabafe4
56 changed files with 553 additions and 745 deletions

View File

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.575
Current extension version is: 2.0.581
Taken from upstream commit: 2030d171
Taken from upstream commit: 790e2124

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.0.575';
var pdfjsBuild = '2030d171';
var pdfjsVersion = '2.0.581';
var pdfjsBuild = '790e2124';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
var pdfjsDisplayAPI = __w_pdfjs_require__(6);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(18);
@ -4228,7 +4228,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.0.575',
apiVersion: '2.0.581',
source: {
data: source.data,
url: source.url,
@ -5562,8 +5562,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.575';
exports.build = build = '2030d171';
exports.version = version = '2.0.581';
exports.build = build = '790e2124';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.0.575';
var pdfjsBuild = '2030d171';
var pdfjsVersion = '2.0.581';
var pdfjsBuild = '790e2124';
var pdfjsCoreWorker = __w_pdfjs_require__(1);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -327,7 +327,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.575';
let workerVersion = '2.0.581';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}

View File

@ -546,7 +546,8 @@ html[dir='rtl'] #sidebarContent {
bottom: 0;
left: 0;
outline: none;
}
#viewerContainer:not(.pdfPresentationMode) {
transition-duration: 200ms;
transition-timing-function: ease;
}
@ -562,12 +563,12 @@ html[dir='rtl'] #viewerContainer {
transition-duration: 0s;
}
html[dir='ltr'] #outerContainer.sidebarOpen #viewerContainer {
html[dir='ltr'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) {
transition-property: left;
left: 200px;
left: var(--sidebar-width);
}
html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer {
html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) {
transition-property: right;
right: 200px;
right: var(--sidebar-width);

View File

@ -669,9 +669,6 @@ let PDFViewerApplication = {
get supportsFullscreen() {
let support;
support = document.fullscreenEnabled === true || document.mozFullScreenEnabled === true;
if (support && _app_options.AppOptions.get('disableFullscreen') === true) {
support = false;
}
return (0, _pdfjsLib.shadow)(this, 'supportsFullscreen', support);
},
get supportsIntegratedFind() {
@ -3177,10 +3174,6 @@ const defaultOptions = {
value: '',
kind: OptionKind.VIEWER
},
disableFullscreen: {
value: _viewer_compatibility.viewerCompatibilityParams.disableFullscreen || false,
kind: OptionKind.VIEWER
},
disableHistory: {
value: false,
kind: OptionKind.VIEWER

View File

@ -728,7 +728,11 @@ CamerasChild::CamerasChild()
mIPCIsAlive(true),
mRequestMutex("mozilla::cameras::CamerasChild::mRequestMutex"),
mReplyMonitor("mozilla::cameras::CamerasChild::mReplyMonitor"),
mZero(0)
mReceivedReply(false),
mReplySuccess(false),
mZero(0),
mReplyInteger(0),
mReplyScary(false)
{
LOG(("CamerasChild: %p", this));

View File

@ -133,6 +133,7 @@ public:
, mCapEngine(aEngine)
, mStreamId(aStreamId)
, mProperties(aProperties)
, mResult(0)
{
// No ShmemBuffer (of the right size) was available, so make an
// extra buffer here. We have no idea when we are going to run and
@ -155,7 +156,8 @@ public:
, mCapEngine(aEngine)
, mStreamId(aStreamId)
, mBuffer(std::move(aBuffer))
, mProperties(aProperties){};
, mProperties(aProperties)
, mResult(0) {};
NS_IMETHOD Run() override {
if (mParent->IsShuttingDown()) {

View File

@ -12,6 +12,7 @@ namespace media {
MediaSystemResourceManagerChild::MediaSystemResourceManagerChild()
: mDestroyed(false)
, mManager(nullptr)
{
}

View File

@ -240,6 +240,7 @@ VideoEngine::GenerateId() {
}
VideoEngine::VideoEngine(UniquePtr<const webrtc::Config>&& aConfig):
mId(0),
mCaptureDevInfo(aConfig->Get<webrtc::CaptureDeviceInfo>()),
mDeviceInfo(nullptr),
mConfig(std::move(aConfig))

View File

@ -32,7 +32,7 @@ private:
static const int64_t kCacheExpiryPeriodMs = 2000;
public:
VideoEngine (){};
VideoEngine() : mId(0) {};
NS_INLINE_DECL_REFCOUNTING(VideoEngine)
static already_AddRefed<VideoEngine> Create(UniquePtr<const webrtc::Config>&& aConfig);

View File

@ -77,6 +77,7 @@ ServiceWorkerContainer::ServiceWorkerContainer(nsIGlobalObject* aGlobal,
: DOMEventTargetHelper(aGlobal)
, mInner(aInner)
{
mInner->AddContainer(this);
Maybe<ServiceWorkerDescriptor> controller = aGlobal->GetController();
if (controller.isSome()) {
mControllerWorker = aGlobal->GetOrCreateServiceWorker(controller.ref());
@ -85,6 +86,7 @@ ServiceWorkerContainer::ServiceWorkerContainer(nsIGlobalObject* aGlobal,
ServiceWorkerContainer::~ServiceWorkerContainer()
{
mInner->RemoveContainer(this);
}
void
@ -358,14 +360,10 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
}
RefPtr<ServiceWorkerContainer> self = this;
RefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>> holder =
new DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>(global);
mInner->Register(clientInfo.ref(), cleanedScopeURL, cleanedScriptURL,
aOptions.mUpdateViaCache)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[self, outer, holder] (const ServiceWorkerRegistrationDescriptor& aDesc) {
holder->Complete();
mInner->Register(
clientInfo.ref(), cleanedScopeURL, cleanedScriptURL, aOptions.mUpdateViaCache,
[self, outer] (const ServiceWorkerRegistrationDescriptor& aDesc) {
ErrorResult rv;
nsIGlobalObject* global = self->GetGlobalIfValid(rv);
if (rv.Failed()) {
@ -375,10 +373,9 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
RefPtr<ServiceWorkerRegistration> reg =
global->GetOrCreateServiceWorkerRegistration(aDesc);
outer->MaybeResolve(reg);
}, [self, outer, holder] (const CopyableErrorResult& aRv) {
holder->Complete();
outer->MaybeReject(CopyableErrorResult(aRv));
})->Track(*holder);
}, [outer] (ErrorResult& aRv) {
outer->MaybeReject(aRv);
});
return outer.forget();
}
@ -415,13 +412,9 @@ ServiceWorkerContainer::GetRegistrations(ErrorResult& aRv)
}
RefPtr<ServiceWorkerContainer> self = this;
RefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationListPromise>> holder =
new DOMMozPromiseRequestHolder<ServiceWorkerRegistrationListPromise>(global);
mInner->GetRegistrations(clientInfo.ref())->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[self, outer, holder] (const nsTArray<ServiceWorkerRegistrationDescriptor>& aDescList) {
holder->Complete();
mInner->GetRegistrations(clientInfo.ref(),
[self, outer] (const nsTArray<ServiceWorkerRegistrationDescriptor>& aDescList) {
ErrorResult rv;
nsIGlobalObject* global = self->GetGlobalIfValid(rv);
if (rv.Failed()) {
@ -437,10 +430,9 @@ ServiceWorkerContainer::GetRegistrations(ErrorResult& aRv)
}
}
outer->MaybeResolve(regList);
}, [self, outer, holder] (const CopyableErrorResult& aRv) {
holder->Complete();
outer->MaybeReject(CopyableErrorResult(aRv));
})->Track(*holder);
}, [self, outer] (ErrorResult& aRv) {
outer->MaybeReject(aRv);
});
return outer.forget();
}
@ -488,13 +480,9 @@ ServiceWorkerContainer::GetRegistration(const nsAString& aURL,
}
RefPtr<ServiceWorkerContainer> self = this;
RefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>> holder =
new DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>(global);
mInner->GetRegistration(clientInfo.ref(), spec)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[self, outer, holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
mInner->GetRegistration(clientInfo.ref(), spec,
[self, outer] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
ErrorResult rv;
nsIGlobalObject* global = self->GetGlobalIfValid(rv);
if (rv.Failed()) {
@ -504,16 +492,16 @@ ServiceWorkerContainer::GetRegistration(const nsAString& aURL,
RefPtr<ServiceWorkerRegistration> reg =
global->GetOrCreateServiceWorkerRegistration(aDescriptor);
outer->MaybeResolve(reg);
}, [self, outer, holder] (const CopyableErrorResult& aRv) {
holder->Complete();
ErrorResult rv;
Unused << self->GetGlobalIfValid(rv);
if (!rv.Failed() && !aRv.Failed()) {
outer->MaybeResolveWithUndefined();
return;
}, [self, outer] (ErrorResult& aRv) {
if (!aRv.Failed()) {
Unused << self->GetGlobalIfValid(aRv);
if (!aRv.Failed()) {
outer->MaybeResolveWithUndefined();
return;
}
}
outer->MaybeReject(CopyableErrorResult(aRv));
})->Track(*holder);
outer->MaybeReject(aRv);
});
return outer.forget();
}
@ -544,13 +532,9 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
RefPtr<ServiceWorkerContainer> self = this;
RefPtr<Promise> outer = mReadyPromise;
RefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>> holder =
new DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>(global);
mInner->GetReady(clientInfo.ref())->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[self, outer, holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
mInner->GetReady(clientInfo.ref(),
[self, outer] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
ErrorResult rv;
nsIGlobalObject* global = self->GetGlobalIfValid(rv);
if (rv.Failed()) {
@ -561,10 +545,9 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
global->GetOrCreateServiceWorkerRegistration(aDescriptor);
NS_ENSURE_TRUE_VOID(reg);
outer->MaybeResolve(reg);
}, [self, outer, holder] (const CopyableErrorResult& aRv) {
holder->Complete();
outer->MaybeReject(CopyableErrorResult(aRv));
})->Track(*holder);
}, [self, outer] (ErrorResult& aRv) {
outer->MaybeReject(aRv);
});
return mReadyPromise;
}

View File

@ -26,21 +26,35 @@ public:
class Inner
{
public:
virtual RefPtr<ServiceWorkerRegistrationPromise>
virtual void
AddContainer(ServiceWorkerContainer* aOuter) = 0;
virtual void
RemoveContainer(ServiceWorkerContainer* aOuter) = 0;
virtual void
Register(const ClientInfo& aClientInfo,
const nsACString& aScopeURL,
const nsACString& aScriptURL,
ServiceWorkerUpdateViaCache aUpdateViaCache) const = 0;
ServiceWorkerUpdateViaCache aUpdateViaCache,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const = 0;
virtual RefPtr<ServiceWorkerRegistrationPromise>
virtual void
GetRegistration(const ClientInfo& aClientInfo,
const nsACString& aURL) const = 0;
const nsACString& aURL,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const = 0;
virtual RefPtr<ServiceWorkerRegistrationListPromise>
GetRegistrations(const ClientInfo& aClientInfo) const = 0;
virtual void
GetRegistrations(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationListCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const = 0;
virtual RefPtr<ServiceWorkerRegistrationPromise>
GetReady(const ClientInfo& aClientInfo) const = 0;
virtual void
GetReady(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};

View File

@ -9,56 +9,166 @@
namespace mozilla {
namespace dom {
RefPtr<ServiceWorkerRegistrationPromise>
ServiceWorkerContainerImpl::~ServiceWorkerContainerImpl()
{
MOZ_DIAGNOSTIC_ASSERT(!mOuter);
}
ServiceWorkerContainerImpl::ServiceWorkerContainerImpl()
: mOuter(nullptr)
{
}
void
ServiceWorkerContainerImpl::AddContainer(ServiceWorkerContainer* aOuter)
{
MOZ_DIAGNOSTIC_ASSERT(aOuter);
MOZ_DIAGNOSTIC_ASSERT(!mOuter);
mOuter = aOuter;
}
void
ServiceWorkerContainerImpl::RemoveContainer(ServiceWorkerContainer* aOuter)
{
MOZ_DIAGNOSTIC_ASSERT(aOuter);
MOZ_DIAGNOSTIC_ASSERT(mOuter == aOuter);
mOuter = nullptr;
}
void
ServiceWorkerContainerImpl::Register(const ClientInfo& aClientInfo,
const nsACString& aScopeURL,
const nsACString& aScriptURL,
ServiceWorkerUpdateViaCache aUpdateViaCache) const
ServiceWorkerUpdateViaCache aUpdateViaCache,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const
{
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (NS_WARN_IF(!global)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
return swm->Register(aClientInfo, aScopeURL, aScriptURL, aUpdateViaCache);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>>(global);
swm->Register(aClientInfo, aScopeURL, aScriptURL, aUpdateViaCache)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
successCB(aDescriptor);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aResult) {
holder->Complete();
failureCB(CopyableErrorResult(aResult));
})->Track(*holder);
}
RefPtr<ServiceWorkerRegistrationPromise>
void
ServiceWorkerContainerImpl::GetRegistration(const ClientInfo& aClientInfo,
const nsACString& aURL) const
const nsACString& aURL,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const
{
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (NS_WARN_IF(!global)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
return swm->GetRegistration(aClientInfo, aURL);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>>(global);
swm->GetRegistration(aClientInfo, aURL)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
successCB(aDescriptor);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aResult) {
holder->Complete();
failureCB(CopyableErrorResult(aResult));
})->Track(*holder);
}
RefPtr<ServiceWorkerRegistrationListPromise>
ServiceWorkerContainerImpl::GetRegistrations(const ClientInfo& aClientInfo) const
void
ServiceWorkerContainerImpl::GetRegistrations(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationListCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const
{
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
return ServiceWorkerRegistrationListPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (NS_WARN_IF(!global)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
return swm->GetRegistrations(aClientInfo);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationListPromise>>(global);
swm->GetRegistrations(aClientInfo)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const nsTArray<ServiceWorkerRegistrationDescriptor>& aList) {
holder->Complete();
successCB(aList);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aResult) {
holder->Complete();
failureCB(CopyableErrorResult(aResult));
})->Track(*holder);
}
RefPtr<ServiceWorkerRegistrationPromise>
ServiceWorkerContainerImpl::GetReady(const ClientInfo& aClientInfo) const
void
ServiceWorkerContainerImpl::GetReady(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const
{
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (NS_WARN_IF(!global)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
return swm->WhenReady(aClientInfo);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (NS_WARN_IF(!swm)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>>(global);
swm->WhenReady(aClientInfo)->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
successCB(aDescriptor);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aResult) {
holder->Complete();
failureCB(CopyableErrorResult(aResult));
})->Track(*holder);
}
} // namespace dom

View File

@ -15,26 +15,42 @@ namespace dom {
// Lightweight serviceWorker APIs collection.
class ServiceWorkerContainerImpl final : public ServiceWorkerContainer::Inner
{
~ServiceWorkerContainerImpl() = default;
ServiceWorkerContainer* mOuter;
~ServiceWorkerContainerImpl();
public:
ServiceWorkerContainerImpl() = default;
ServiceWorkerContainerImpl();
RefPtr<ServiceWorkerRegistrationPromise>
void
AddContainer(ServiceWorkerContainer* aOuter) override;
void
RemoveContainer(ServiceWorkerContainer* aOuter) override;
void
Register(const ClientInfo& aClientInfo,
const nsACString& aScopeURL,
const nsACString& aScriptURL,
ServiceWorkerUpdateViaCache aUpdateViaCache) const override;
ServiceWorkerUpdateViaCache aUpdateViaCache,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const override;
RefPtr<ServiceWorkerRegistrationPromise>
void
GetRegistration(const ClientInfo& aClientInfo,
const nsACString& aURL) const override;
const nsACString& aURL,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const override;
RefPtr<ServiceWorkerRegistrationListPromise>
GetRegistrations(const ClientInfo& aClientInfo) const override;
void
GetRegistrations(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationListCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const override;
RefPtr<ServiceWorkerRegistrationPromise>
GetReady(const ClientInfo& aClientInfo) const override;
void
GetReady(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) const override;
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerContainerImpl, override)
};

View File

@ -213,13 +213,9 @@ ServiceWorkerRegistration::Update(ErrorResult& aRv)
}
RefPtr<ServiceWorkerRegistration> self = this;
RefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>> holder =
new DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>(global);
mInner->Update()->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[outer, self, holder](const ServiceWorkerRegistrationDescriptor& aDesc) {
holder->Complete();
mInner->Update(
[outer, self](const ServiceWorkerRegistrationDescriptor& aDesc) {
nsIGlobalObject* global = self->GetParentObject();
MOZ_DIAGNOSTIC_ASSERT(global);
RefPtr<ServiceWorkerRegistration> ref =
@ -229,10 +225,9 @@ ServiceWorkerRegistration::Update(ErrorResult& aRv)
return;
}
outer->MaybeResolve(ref);
}, [outer, holder] (const CopyableErrorResult& aRv) {
holder->Complete();
outer->MaybeReject(CopyableErrorResult(aRv));
})->Track(*holder);
}, [outer] (ErrorResult& aRv) {
outer->MaybeReject(aRv);
});
return outer.forget();
}
@ -256,18 +251,12 @@ ServiceWorkerRegistration::Unregister(ErrorResult& aRv)
return nullptr;
}
RefPtr<DOMMozPromiseRequestHolder<GenericPromise>> holder =
new DOMMozPromiseRequestHolder<GenericPromise>(global);
mInner->Unregister()->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[outer, holder] (bool aSuccess) {
holder->Complete();
mInner->Unregister(
[outer] (bool aSuccess) {
outer->MaybeResolve(aSuccess);
}, [outer, holder] (nsresult aRv) {
holder->Complete();
}, [outer] (ErrorResult& aRv) {
outer->MaybeReject(aRv);
})->Track(*holder);
});
return outer.forget();
}

View File

@ -44,11 +44,13 @@ public:
virtual void
ClearServiceWorkerRegistration(ServiceWorkerRegistration* aReg) = 0;
virtual RefPtr<ServiceWorkerRegistrationPromise>
Update() = 0;
virtual void
Update(ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) = 0;
virtual RefPtr<GenericPromise>
Unregister() = 0;
virtual void
Unregister(ServiceWorkerBoolCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) = 0;
};
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_SERVICEWORKERREGISTRATION_IID)

View File

@ -523,41 +523,66 @@ public:
} // namespace
RefPtr<ServiceWorkerRegistrationPromise>
ServiceWorkerRegistrationMainThread::Update()
void
ServiceWorkerRegistrationMainThread::Update(ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (!global) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
nsCOMPtr<nsIPrincipal> principal = mDescriptor.GetPrincipal();
if (!principal) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
RefPtr<MainThreadUpdateCallback> cb = new MainThreadUpdateCallback();
UpdateInternal(principal, NS_ConvertUTF16toUTF8(mScope), cb);
return cb->Promise();
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>>(global);
cb->Promise()->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
successCB(aDescriptor);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aRv) {
holder->Complete();
failureCB(CopyableErrorResult(aRv));
})->Track(*holder);
}
RefPtr<GenericPromise>
ServiceWorkerRegistrationMainThread::Unregister()
void
ServiceWorkerRegistrationMainThread::Unregister(ServiceWorkerBoolCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsIGlobalObject* global = mOuter->GetParentObject();
if (!global) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
nsCOMPtr<nsIServiceWorkerManager> swm =
mozilla::services::GetServiceWorkerManager();
if (!swm) {
return GenericPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
nsCOMPtr<nsIPrincipal> principal = mDescriptor.GetPrincipal();
if (!principal) {
return GenericPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
RefPtr<UnregisterCallback> cb = new UnregisterCallback();
@ -565,10 +590,21 @@ ServiceWorkerRegistrationMainThread::Unregister()
nsresult rv = swm->Unregister(principal, cb,
NS_ConvertUTF8toUTF16(mDescriptor.Scope()));
if (NS_FAILED(rv)) {
return GenericPromise::CreateAndReject(rv, __func__);
aFailureCB(CopyableErrorResult(rv));
return;
}
return cb->Promise();
auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<GenericPromise>>(global);
cb->Promise()->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (bool aResult) {
holder->Complete();
successCB(aResult);
}, [failureCB = std::move(aFailureCB), holder] (nsresult aRv) {
holder->Complete();
failureCB(CopyableErrorResult(aRv));
})->Track(*holder);
}
////////////////////////////////////////////////////
@ -712,88 +748,120 @@ ServiceWorkerRegistrationWorkerThread::ClearServiceWorkerRegistration(ServiceWor
mOuter = nullptr;
}
RefPtr<ServiceWorkerRegistrationPromise>
ServiceWorkerRegistrationWorkerThread::Update()
void
ServiceWorkerRegistrationWorkerThread::Update(ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB)
{
if (NS_WARN_IF(!mWorkerRef->GetPrivate())) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(mWorkerRef->GetPrivate(),
"ServiceWorkerRegistration::Update");
if (NS_WARN_IF(!workerRef)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
nsIGlobalObject* global = workerRef->Private()->GlobalScope();
if (NS_WARN_IF(!global)) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
// Eventually we need to support all workers, but for right now this
// code assumes we're on a service worker global as self.registration.
if (NS_WARN_IF(!workerRef->Private()->IsServiceWorker())) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
// Avoid infinite update loops by ignoring update() calls during top
// level script evaluation. See:
// https://github.com/slightlyoff/ServiceWorker/issues/800
if (workerRef->Private()->IsLoadingWorkerScript()) {
return ServiceWorkerRegistrationPromise::CreateAndResolve(mDescriptor,
__func__);
aSuccessCB(mDescriptor);
return;
}
// Eventually we need to support all workers, but for right now this
// code assumes we're on a service worker global as self.registration.
if (NS_WARN_IF(!workerRef->Private()->IsServiceWorker())) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
}
auto promise = MakeRefPtr<ServiceWorkerRegistrationPromise::Private>(__func__);
auto holder =
MakeRefPtr<DOMMozPromiseRequestHolder<ServiceWorkerRegistrationPromise>>(global);
RefPtr<ServiceWorkerRegistrationPromise::Private> outer =
new ServiceWorkerRegistrationPromise::Private(__func__);
promise->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
holder->Complete();
successCB(aDescriptor);
}, [failureCB = std::move(aFailureCB), holder] (const CopyableErrorResult& aRv) {
holder->Complete();
failureCB(CopyableErrorResult(aRv));
})->Track(*holder);
RefPtr<SWRUpdateRunnable> r =
new SWRUpdateRunnable(workerRef,
outer,
promise,
workerRef->Private()->GetServiceWorkerDescriptor());
nsresult rv = workerRef->Private()->DispatchToMainThread(r.forget());
if (NS_FAILED(rv)) {
outer->Reject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
return outer.forget();
promise->Reject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
return;
}
return outer.forget();
}
RefPtr<GenericPromise>
ServiceWorkerRegistrationWorkerThread::Unregister()
void
ServiceWorkerRegistrationWorkerThread::Unregister(ServiceWorkerBoolCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB)
{
if (NS_WARN_IF(!mWorkerRef->GetPrivate())) {
return GenericPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(mWorkerRef->GetPrivate(), __func__);
if (NS_WARN_IF(!workerRef)) {
return GenericPromise::CreateAndReject(
NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
// Eventually we need to support all workers, but for right now this
// code assumes we're on a service worker global as self.registration.
if (NS_WARN_IF(!workerRef->Private()->IsServiceWorker())) {
return GenericPromise::CreateAndReject(
NS_ERROR_DOM_SECURITY_ERR, __func__);
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
RefPtr<GenericPromise::Private> outer = new GenericPromise::Private(__func__);
nsIGlobalObject* global = workerRef->Private()->GlobalScope();
if (!global) {
aFailureCB(CopyableErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
return;
}
auto promise = MakeRefPtr<GenericPromise::Private>(__func__);
auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<GenericPromise>>(global);
promise->Then(
global->EventTargetFor(TaskCategory::Other), __func__,
[successCB = std::move(aSuccessCB), holder] (bool aResult) {
holder->Complete();
successCB(aResult);
}, [failureCB = std::move(aFailureCB), holder] (nsresult aRv) {
holder->Complete();
failureCB(CopyableErrorResult(aRv));
})->Track(*holder);
RefPtr<StartUnregisterRunnable> r =
new StartUnregisterRunnable(workerRef, outer, mDescriptor);
new StartUnregisterRunnable(workerRef, promise, mDescriptor);
nsresult rv = workerRef->Private()->DispatchToMainThread(r);
if (NS_FAILED(rv)) {
outer->Reject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
return outer.forget();
promise->Reject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__);
return;
}
return outer.forget();
}
void

View File

@ -42,11 +42,13 @@ public:
void
ClearServiceWorkerRegistration(ServiceWorkerRegistration* aReg) override;
RefPtr<ServiceWorkerRegistrationPromise>
Update() override;
void
Update(ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) override;
RefPtr<GenericPromise>
Unregister() override;
void
Unregister(ServiceWorkerBoolCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) override;
// ServiceWorkerRegistrationListener
void
@ -109,11 +111,13 @@ public:
void
ClearServiceWorkerRegistration(ServiceWorkerRegistration* aReg) override;
RefPtr<ServiceWorkerRegistrationPromise>
Update() override;
void
Update(ServiceWorkerRegistrationCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) override;
RefPtr<GenericPromise>
Unregister() override;
void
Unregister(ServiceWorkerBoolCallback&& aSuccessCB,
ServiceWorkerFailureCallback&& aFailureCB) override;
void
UpdateFound();

View File

@ -25,6 +25,18 @@ typedef MozPromise<ServiceWorkerRegistrationDescriptor, CopyableErrorResult, fal
typedef MozPromise<nsTArray<ServiceWorkerRegistrationDescriptor>, CopyableErrorResult, false>
ServiceWorkerRegistrationListPromise;
typedef std::function<void (const ServiceWorkerRegistrationDescriptor&)>
ServiceWorkerRegistrationCallback;
typedef std::function<void (const nsTArray<ServiceWorkerRegistrationDescriptor>&)>
ServiceWorkerRegistrationListCallback;
typedef std::function<void (bool)>
ServiceWorkerBoolCallback;
typedef std::function<void (ErrorResult&)>
ServiceWorkerFailureCallback;
bool
ServiceWorkerParentInterceptEnabled();

View File

@ -270,6 +270,9 @@ VRPose::VRPose(nsISupports* aParent, const gfx::VRHMDSensorState& aState)
VRPose::VRPose(nsISupports* aParent)
: Pose(aParent)
{
mVRState.inputFrameID = 0;
mVRState.timestamp = 0.0;
mVRState.flags = gfx::VRDisplayCapabilityFlags::Cap_None;
mFrameId = 0;
mozilla::HoldJSObjects(this);
}
@ -925,6 +928,9 @@ VRFrameInfo::Update(const gfx::VRDisplayInfo& aInfo,
VRFrameInfo::VRFrameInfo()
: mTimeStampOffset(0.0f)
{
mVRState.inputFrameID = 0;
mVRState.timestamp = 0.0;
mVRState.flags = gfx::VRDisplayCapabilityFlags::Cap_None;
}
bool

View File

@ -206,7 +206,7 @@ CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::Pipeli
LayersId layersId = wr::AsLayersId(aPipelineId);
// Check to see if this child process has access to this layer tree.
if (!LayerTreeOwnerTracker::Get()->IsMapped(layersId, OtherPid())) {
NS_ERROR("Unexpected layers id in AllocPAPZCTreeManagerParent; dropping message...");
NS_ERROR("Unexpected layers id in AllocPWebRenderBridgeParent; dropping message...");
return nullptr;
}

View File

@ -106,7 +106,8 @@ struct VRDisplayInfo
struct VRSubmitFrameResultInfo
{
VRSubmitFrameResultInfo()
: mFrameNum(0),
: mFormat(SurfaceFormat::UNKNOWN),
mFrameNum(0),
mWidth(0),
mHeight(0)
{}

View File

@ -431,6 +431,7 @@ VRControllerOpenVR::VRControllerOpenVR(dom::GamepadHand aHand, uint32_t aDisplay
uint32_t aNumButtons, uint32_t aNumTriggers,
uint32_t aNumAxes, const nsCString& aId)
: VRControllerHost(VRDeviceType::OpenVR, aHand, aDisplayID)
, mTrackedIndex(0)
, mVibrateThread(nullptr)
, mIsVibrateStopped(false)
{

View File

@ -40,6 +40,9 @@ bool LaunchApp(const std::vector<std::string>& argv,
posix_spawn_file_actions_t file_actions;
if (posix_spawn_file_actions_init(&file_actions) != 0) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
MOZ_CRASH("base::LaunchApp: posix_spawn_file_actions_init failed");
#endif
return false;
}
auto file_actions_guard = mozilla::MakeScopeExit([&file_actions] {
@ -58,6 +61,9 @@ bool LaunchApp(const std::vector<std::string>& argv,
}
} else {
if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
MOZ_CRASH("base::LaunchApp: posix_spawn_file_actions_adddup2 failed");
#endif
return false;
}
}
@ -66,6 +72,9 @@ bool LaunchApp(const std::vector<std::string>& argv,
// Initialize spawn attributes.
posix_spawnattr_t spawnattr;
if (posix_spawnattr_init(&spawnattr) != 0) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
MOZ_CRASH("base::LaunchApp: posix_spawnattr_init failed");
#endif
return false;
}
auto spawnattr_guard = mozilla::MakeScopeExit([&spawnattr] {
@ -76,12 +85,19 @@ bool LaunchApp(const std::vector<std::string>& argv,
// that aren't named in `file_actions`. (This is an Apple-specific
// extension to posix_spawn.)
if (posix_spawnattr_setflags(&spawnattr, POSIX_SPAWN_CLOEXEC_DEFAULT) != 0) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
MOZ_CRASH("base::LaunchApp: posix_spawnattr_setflags failed");
#endif
return false;
}
// Exempt std{in,out,err} from being closed by POSIX_SPAWN_CLOEXEC_DEFAULT.
for (int fd = 0; fd <= STDERR_FILENO; ++fd) {
if (posix_spawn_file_actions_addinherit_np(&file_actions, fd) != 0) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
MOZ_CRASH("base::LaunchApp: posix_spawn_file_actions_addinherit_np "
"failed");
#endif
return false;
}
}
@ -96,6 +112,16 @@ bool LaunchApp(const std::vector<std::string>& argv,
bool process_handle_valid = pid > 0;
if (!spawn_succeeded || !process_handle_valid) {
#ifdef ASYNC_CONTENTPROC_LAUNCH
if (!spawn_succeeded && !process_handle_valid) {
MOZ_CRASH("base::LaunchApp: spawn_succeeded is false and "
"process_handle_valid is false");
} else if (!spawn_succeeded) {
MOZ_CRASH("base::LaunchApp: spawn_succeeded is false");
} else {
MOZ_CRASH("base::LaunchApp: process_handle_valid is false");
}
#endif
retval = false;
} else {
gProcessLog.print("==> process %d launched child process %d\n",

View File

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
The git commit ID used was abf6ae235b0f15a2656f2d8692ac13708188165e (2018-06-01 13:02:45 +1200)
The git commit ID used was 0677b3027b78c629586b099b5155aa6ac7422674 (2018-06-12 08:48:55 -0700)

View File

@ -51,17 +51,33 @@ struct cubeb_stream {
uint64_t swpos; /* number of frames produced/consumed */
cubeb_data_callback data_cb; /* cb to preapare data */
cubeb_state_callback state_cb; /* cb to notify about state changes */
float volume; /* current volume */
};
static void
float_to_s16(void *ptr, long nsamp)
s16_setvol(void *ptr, long nsamp, float volume)
{
int16_t *dst = ptr;
int32_t mult = volume * 32768;
int32_t s;
while (nsamp-- > 0) {
s = *dst;
s = (s * mult) >> 15;
*(dst++) = s;
}
}
static void
float_to_s16(void *ptr, long nsamp, float volume)
{
int16_t *dst = ptr;
float *src = ptr;
float mult = volume * 32768;
int s;
while (nsamp-- > 0) {
s = lrintf(*(src++) * 32768);
s = lrintf(*(src++) * mult);
if (s < -32768)
s = -32768;
else if (s > 32767)
@ -169,8 +185,12 @@ sndio_mainloop(void *arg)
if (prime > 0)
prime--;
if ((s->mode & SIO_PLAY) && s->conv)
float_to_s16(s->pbuf, nfr * s->pchan);
if (s->mode & SIO_PLAY) {
if (s->conv)
float_to_s16(s->pbuf, nfr * s->pchan, s->volume);
else
s16_setvol(s->pbuf, nfr * s->pchan, s->volume);
}
if (s->mode & SIO_REC)
rstart = 0;
@ -372,6 +392,7 @@ sndio_stream_init(cubeb * context,
if (s->rbuf == NULL)
goto err;
}
s->volume = 1.;
*stream = s;
DPR("sndio_stream_init() end, ok\n");
(void)context;
@ -476,7 +497,11 @@ sndio_stream_set_volume(cubeb_stream *s, float volume)
{
DPR("sndio_stream_set_volume(%f)\n", volume);
pthread_mutex_lock(&s->mtx);
sio_setvol(s->hdl, SIO_MAXVOL * volume);
if (volume < 0.)
volume = 0.;
else if (volume > 1.0)
volume = 1.;
s->volume = volume;
pthread_mutex_unlock(&s->mtx);
return CUBEB_OK;
}

View File

@ -41,7 +41,9 @@ namespace test {
class SdpTest : public ::testing::Test {
public:
SdpTest() : sdp_ptr_(nullptr) {
SdpTest()
: final_level_(0)
, sdp_ptr_(nullptr) {
}
~SdpTest() {
@ -1506,7 +1508,8 @@ class NewSdpTest : public ::testing::Test,
public ::testing::WithParamInterface<
::testing::tuple<bool, bool> > {
public:
NewSdpTest() {}
NewSdpTest() : mSdpErrorHolder(nullptr) {
}
void ParseSdp(const std::string &sdp, bool expectSuccess = true) {
if (::testing::get<1>(GetParam())) {

View File

@ -236,6 +236,9 @@ class JsepVideoCodecDescription : public JsepCodecDescription {
mTmmbrEnabled(false),
mRembEnabled(false),
mFECEnabled(false),
mREDPayloadType(0),
mULPFECPayloadType(0),
mProfileLevelId(0),
mPacketizationMode(0)
{
// Add supported rtcp-fb types
@ -763,7 +766,8 @@ class JsepApplicationCodecDescription : public JsepCodecDescription {
mLocalPort(localPort),
mLocalMaxMessageSize(localMaxMessageSize),
mRemotePort(0),
mRemoteMaxMessageSize(0)
mRemoteMaxMessageSize(0),
mRemoteMMSSet(false)
{
}

View File

@ -43,7 +43,8 @@ public:
mSessionId(0),
mSessionVersion(0),
mUuidGen(std::move(uuidgen)),
mSdpHelper(&mLastError)
mSdpHelper(&mLastError),
mRunRustParser(false)
{
}

View File

@ -19,6 +19,7 @@ RtpSourceObserver::RtpSourceEntry::ToLinearAudioLevel() const
}
RtpSourceObserver::RtpSourceObserver() :
mMaxJitterWindow(0),
mLevelGuard("RtpSourceObserver::mLevelGuard") {}
void

View File

@ -12,7 +12,14 @@ namespace mozilla {
class RunningStat
{
public:
RunningStat() : mN(0) {}
RunningStat()
: mN(0)
, mOldM(0.0)
, mNewM(0.0)
, mOldS(0.0)
, mNewS(0.0)
{
}
void Clear()
{

View File

@ -80,6 +80,20 @@ WebrtcGmpVideoEncoder::WebrtcGmpVideoEncoder()
, mCallback(nullptr)
, mCachedPluginId(0)
{
mCodecParams.mGMPApiVersion = 0;
mCodecParams.mCodecType = kGMPVideoCodecInvalid;
mCodecParams.mPLType = 0;
mCodecParams.mWidth = 0;
mCodecParams.mHeight = 0;
mCodecParams.mStartBitrate = 0;
mCodecParams.mMaxBitrate = 0;
mCodecParams.mMinBitrate = 0;
mCodecParams.mMaxFramerate = 0;
mCodecParams.mFrameDroppingOn = false;
mCodecParams.mKeyFrameInterval = 0;
mCodecParams.mQPMax = 0;
mCodecParams.mNumberOfSimulcastStreams = 0;
mCodecParams.mMode = kGMPCodecModeInvalid;
if (mPCHandle.empty()) {
mPCHandle = WebrtcGmpPCHandleSetter::GetCurrentHandle();
}

View File

@ -20,6 +20,7 @@ WebrtcMediaDataDecoder::WebrtcMediaDataDecoder()
, mImageContainer(layers::LayerManager::CreateImageContainer(
layers::ImageContainer::ASYNCHRONOUS))
, mFactory(new PDMFactory())
, mTrackType(TrackInfo::kUndefinedTrack)
{
}

View File

@ -2175,6 +2175,8 @@ class MediaPipelineReceiveVideo::PipelineListener
public:
explicit PipelineListener(dom::MediaStreamTrack* aTrack)
: GenericReceiveListener(aTrack)
, mWidth(0)
, mHeight(0)
, mImageContainer(
LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS))
, mMutex("Video PipelineListener")

View File

@ -236,7 +236,8 @@ namespace mozilla {
RTCStatsQuery::RTCStatsQuery(bool internal) :
failed(false),
internalStats(internal),
grabAllLevels(false) {
grabAllLevels(false),
now(0.0) {
}
RTCStatsQuery::~RTCStatsQuery() {
@ -339,6 +340,9 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
, mActiveOnWindow(false)
, mPacketDumpEnabled(false)
, mPacketDumpFlagsMutex("Packet dump flags mutex")
, listenPort(0)
, connectPort(0)
, connectStr(nullptr)
{
MOZ_ASSERT(NS_IsMainThread());
auto log = RLogConnector::CreateInstance();

View File

@ -68,7 +68,12 @@ public:
private:
SipccSdpMediaSection(size_t level, const SipccSdpAttributeList* sessionLevel)
: SdpMediaSection(level), mAttributeList(sessionLevel)
: SdpMediaSection(level),
mMediaType(static_cast<MediaType>(0)),
mPort(0),
mPortCount(0),
mProtocol(static_cast<Protocol>(0)),
mAttributeList(sessionLevel)
{
}

View File

@ -347,8 +347,6 @@ extern uint32_t sdp_getnextnumtok(const char *str, const char **str_end,
extern uint32_t sdp_getnextnumtok_or_null(const char *str, const char **str_end,
const char *delim, tinybool *null_ind,
sdp_result_e *result);
extern tinybool sdp_getchoosetok(const char *str, const char **str_end,
const char *delim, sdp_result_e *result);
extern
tinybool verify_sdescriptions_mki(char *buf, char *mkiVal, uint16_t *mkiLen);

View File

@ -1162,15 +1162,11 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, uint16_t level, const char *ptr)
}
port_ptr = port;
for (i=0; i < SDP_MAX_PORT_PARAMS; i++) {
if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result) == TRUE) {
num[i] = SDP_CHOOSE_PARAM;
} else {
num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
"/ \t", &result);
if (result != SDP_SUCCESS) {
break;
}
}
num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
"/ \t", &result);
if (result != SDP_SUCCESS) {
break;
}
num_port_params++;
}
@ -1401,8 +1397,6 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, uint16_t level, const char *ptr)
return (SDP_INVALID_PARAMETER);
}
mca_p->sctp_fmt = SDP_SCTP_MEDIA_FMT_WEBRTC_DATACHANNEL;
} else if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result)) {
sctp_port = SDP_CHOOSE_PARAM;
} else {
sctp_port = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
"/ \t", &result);

View File

@ -432,69 +432,6 @@ uint32_t sdp_getnextnumtok (const char *str, const char **str_end,
}
/* See if the next token in a string is the choose character. The delim
* characters are passed in as a param. The check also will not go past
* a new line char or the end of the string. Skip any delimiters before
* the token.
*/
tinybool sdp_getchoosetok (const char *str, const char **str_end,
const char *delim, sdp_result_e *result)
{
const char *b;
int flag2moveon;
if ((str == NULL) || (str_end == NULL)) {
*result = SDP_FAILURE;
return(FALSE);
}
/* Locate front of token, skipping any delimiters */
for ( ; ((*str != '\0') && (*str != '\n') && (*str != '\r')); str++) {
flag2moveon = 1; /* Default to move on unless we find a delimiter */
for (b=delim; *b; b++) {
if (*str == *b) {
flag2moveon = 0;
break;
}
}
if( flag2moveon ) {
break; /* We're at the beginning of the token */
}
}
/* Make sure there's really a token present. */
if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
*result = SDP_FAILURE;
*str_end = (char *)str;
return(FALSE);
}
/* See if the token is '$' followed by a delimiter char or end of str. */
if (*str == '$') {
str++;
if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
*result = SDP_SUCCESS;
/* skip the choose char in the string. */
*str_end = (char *)(str+1);
return(TRUE);
}
for (b=delim; *b; b++) {
if (*str == *b) {
*result = SDP_SUCCESS;
/* skip the choose char in the string. */
*str_end = (char *)(str+1);
return(TRUE);
}
}
}
/* If the token was not '$' followed by a delim, token is not choose */
*result = SDP_SUCCESS;
*str_end = (char *)str;
return(FALSE);
}
/*
* SDP Crypto Utility Functions.
*

View File

@ -307,6 +307,11 @@ DataChannelConnection::DataChannelConnection(DataConnectionListener *listener,
nsIEventTarget *aTarget)
: NeckoTargetHolder(aTarget)
, mLock("netwerk::sctp::DataChannelConnection")
, mSendInterleaved(false)
, mPpidFragmentation(false)
, mMaxMessageSizeSet(false)
, mMaxMessageSize(0)
, mAllocateEven(false)
{
mCurrentStream = 0;
mState = CLOSED;

View File

@ -67,7 +67,12 @@ public:
const uint8_t *GetData() { return (const uint8_t *)(mData + mPos); };
protected:
OutgoingMsg() = default;; // Use this for inheritance only
OutgoingMsg() // Use this for inheritance only
: mLength(0)
, mData(nullptr)
, mInfo(nullptr)
, mPos(0)
{};
size_t mLength;
const uint8_t *mData;
struct sctp_sendv_spa *mInfo;
@ -382,6 +387,7 @@ public:
, mPrPolicy(policy)
, mPrValue(value)
, mFlags(flags)
, mId(0)
, mIsRecvBinary(false)
, mBufferedThreshold(0) // default from spec
, mMainThreadEventTarget(connection->GetNeckoTarget())

View File

@ -111,7 +111,8 @@ private:
//// StorageBaseStatementInternal
StorageBaseStatementInternal::StorageBaseStatementInternal()
: mAsyncStatement(nullptr)
: mNativeConnection(nullptr)
, mAsyncStatement(nullptr)
{
}

View File

@ -111,6 +111,8 @@ static StatementClassInfo sStatementClassInfo;
Statement::Statement()
: StorageBaseStatementInternal()
, mDBStatement(nullptr)
, mParamCount(0)
, mResultColumnCount(0)
, mColumnNames()
, mExecuting(false)
{

View File

@ -1,35 +0,0 @@
FROM ubuntu:xenial
MAINTAINER Rail Aliiev <rail@mozilla.com>
# Required software
ENV DEBIAN_FRONTEND noninteractive
# Chain apt-get commands with apt-get clean in a single docker RUN
# to make sure that files are removed within a single docker layer
RUN apt-get update -q && \
apt-get install -yyq --no-install-recommends \
python mercurial curl python-boto python-setuptools python-cryptography \
python-dev gcc liblzma-dev && \
apt-get clean
COPY requirements.txt /tmp/
# python-pip installs a lot of dependencies increasing the size of an image
# drastically.
RUN easy_install pip
RUN pip install -r /tmp/requirements.txt
RUN hg clone https://hg.mozilla.org/build/tools /home/worker/tools
RUN useradd -d /home/worker -s /bin/bash -m worker
RUN mkdir /home/worker/bin
COPY scripts/* /home/worker/bin/
RUN mkdir /home/worker/keys
COPY *.pubkey /home/worker/keys/
COPY runme.sh /runme.sh
COPY submit_complete.sh /submit_complete.sh
RUN chmod 755 /home/worker/bin/* /runme.sh /submit_complete.sh
ENV HOME /home/worker
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME worker

View File

@ -1,17 +0,0 @@
DOCKERIO_USERNAME =$(error DOCKERIO_USERNAME should be set)
IMAGE_NAME = funsize-balrog-submitter
FULL_IMAGE_NAME = $(DOCKERIO_USERNAME)/$(IMAGE_NAME)
build:
docker build -t $(FULL_IMAGE_NAME) --no-cache --rm .
push:
docker push $(FULL_IMAGE_NAME):latest
pull:
docker pull $(FULL_IMAGE_NAME):latest
update_pubkeys:
curl https://hg.mozilla.org/mozilla-central/raw-file/default/toolkit/mozapps/update/updater/nightly_aurora_level3_primary.der | openssl x509 -inform DER -pubkey -noout > nightly.pubkey
curl https://hg.mozilla.org/mozilla-central/raw-file/default/toolkit/mozapps/update/updater/dep1.der | openssl x509 -inform DER -pubkey -noout > dep.pubkey
curl https://hg.mozilla.org/mozilla-central/raw-file/default/toolkit/mozapps/update/updater/release_primary.der | openssl x509 -inform DER -pubkey -noout > release.pubkey

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzjHSobdeiQ3JHP/cCIOp
WaX9y12rL5mIo9OR9bpqEZdD0yXJJJeZA887Mv8slqsM+qObMUpKvfEE6zyYPIZJ
ANib31neI5BBYHhfhf2f5EnkilSYlmU3Gx+uRsmsdt58PpYe124tOAGgca/8bUy3
eb6kUUTwvMI0oWQuPkGUaoHVQyj/bBMTrIkyF3UbfFtiX/SfOPvIoabNUe+pQHUe
pqC2+RxzDGj+shTq/hYhtXlptFzsEEb2+0foLy0MY8C30dP2QqbM2iavvr/P8OcS
Gm3H0TQcRzIEBzvPcIjiZi1nQj/r/3TlYRNCjuYT/HsNLXrB/U5Tc990jjAUJxdH
0wIDAQAB
-----END PUBLIC KEY-----

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4j/IS3gWbyVVnWn4ZRnC
Fuzb6VAaHa0I+4E504ekhVAhbKlSfBstkLbXajdjUVAJpn02zWnOaTl5KAdpDpIp
SkdA4mK20ej3/Ij7gIt8IwaX+ArXL8mP84pxDn5BgaNADm3206Z6YQzc/TDYu529
qkDFmLqNUVRJAhPO+qqhKHIcVGh8HUHXN6XV1qOFip+UU0M474jAGgurVmAv8Rh7
VvM0v5KmB6V6WHwM5gwjg2yRY/o+xYIsNeSes9rpp+MOs/RnUA6LI4WZGY4YahvX
VclIXBDgbWPYtojexIJkmYj8JIIRsh3eCsrRRe14fq7cBurp3CxBYMlDHf0RUoaq
hQIDAQAB
-----END PUBLIC KEY-----

View File

@ -1,14 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAth151NGY8PBzn0bii9Yc
AjYHZDwP9Lj1c3owG0zLqW2kPcdp86QTAcoYunHGYFFakNG3tooZhzwkMjZ1OrXc
ERjD6AuVSGIBdsKtKP4vLtMjDUteFN4K2+rveozcnYFZuTWEajGu8uoYsv4QgdEA
nTBC39j0J33xlfUR+XKuxzhxNrFX+fRFWuLDJrPziMcVA/mzf0gXlhtEsfV0HYyg
yWpHdIWww+llysD1QOQAHk94Ss8c/4BFXFxlwlLeNlB1ZqLm1LsNy0jUy9EHeO3C
H6eqmiFEbpdjlrkJdgR1NcTzeY/Qf/nhWH6BAZrSapQycF7OSLU+rFWMQUElSPLc
NVl7oNAAfSYLTvRjPGi+mJK3wGFQw1EpwQl+elE1oj4+sHvIVpDrLb6btpxfr1cZ
pR4Di/hkOIymxEDWvtUhOxUXnYbDKQSDcAHKM/xR3sdIAiVtVuL4hyBwlAqkQc2j
H+SmnCbazgnq5+dN4y5DjoOgbZQ/koE3s3bUzzMeIxaul9v4gMtGROw3PQ3OZcP0
lgjPRhY+NeTnWMo2nGb4/eS6Cn2qFLfbEQjsj6pJJBNKfvK/gm1jXb3PgXXdf8+d
2xTPOX8QNpSK7C0w4vYlvSpYZlsx2cznEOV6LDqP0QHUnmd/k1xWRRGiQ7gtT+BV
Fn0h7JyTGmEdFu6l4OhS8hMCAwEAAQ==
-----END PUBLIC KEY-----

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvH4r94FpQ0gvr1hhTfV9
NUeWPJ5CN6TZRq7v/Dc4nkJ1J4IP1B3UEii34tcNKpy1nKupiZuTT6T1zQYT+z5x
3UkDF9qQboQ8RNb/BEz/cN3on/LTEnZ7YSraRL11M6cEB8mvmJxddCEquwqccRbs
Usp8WUB7uRv1w6Anley7N9F/LE1iLPwJasZypRnzWb3aYsJy0cMFOYy+OXVdpktn
qYqlNIjnt84u4Nil6UXnBbIJNUVOCY8wOFClNvVpubjPkWK1gtdWy3x/hJU5RpAO
K9cnHxq4M/I4SUWTWO3r7yweQiHG4Jyoc7sP1jkwjBkSG93sDEycfwOdOoZft3wN
sQIDAQAB
-----END PUBLIC KEY-----

View File

@ -1,14 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxCHbY+fP3dvaP9XVbmK6
i4rbqo72INEWgDSYbr/DIYfCSzHC9H8pU8dyjt+Nd8OtoUZtBD1N9fP7SlrvPZSI
ZSW4k0e9Ky5aV3Uy+ivamSvYszkhqdeP2y7MBu73XHKYONR9PnKa+ovmREwSEI+h
1e0ebm8zvF7Ndwx0mOeZkDu9SDkDGg4aj2xrJyBBOuGVjuctMZ6l1davANI5xiJ0
GBEU3tR1gJs1T4vLBis5mEFn9y4kgyw/HrxmRYGnZL4fLb2fTI+pNW0Twu3KWwwi
LgLkkVrNWiHSk7YWqxjcg5IA3pQETQ17paTHoB5Mnkvuh6MkDXvRG5VgAHZAigr6
fJMsasOUaBeos/cD1LDQEIObpetlxc0Fiu/lvUts0755otkhI+yv35+wUa6GJrsE
CsT7c/LaFtQXg06aGXbMLDn0bE/e+nw9KWT/rE1iYXMFkzrqoTeYJ+v7/fD/ywU8
m8l4CZmXxzd/RogMrM3xl+j4ucAAltDQyL4yLySaIT05w5U8z2zJDEXFvpFDSRfF
K3kjLwGub7wNwaQDuh/msIUdavu4g+GNikCXAJ8AssLuYatyHoltd2tf+EIIDW3U
zzLpymnLo3cAz3IPfXyqVB+mcLcpqbHjl3hWms6l1wGtz6S4WqdrWs/KfzS5EyDK
r63xn1Rg/XFmR57EsFEXAZ8CAwEAAQ==
-----END PUBLIC KEY-----

View File

@ -1,27 +0,0 @@
#!/bin/bash
set -xe
test "$PARENT_TASK_ARTIFACTS_URL_PREFIX"
test "$BALROG_API_ROOT"
test "$SHA1_SIGNING_CERT"
test "$SHA384_SIGNING_CERT"
ARTIFACTS_DIR="/home/worker/artifacts"
mkdir -p "$ARTIFACTS_DIR"
curl --location --retry 10 --retry-delay 10 -o "$ARTIFACTS_DIR/manifest.json" \
"$PARENT_TASK_ARTIFACTS_URL_PREFIX/manifest.json"
cat "$ARTIFACTS_DIR/manifest.json"
# EXTRA_BALROG_SUBMITTER_PARAMS is optional
# shellcheck disable=SC2086
python /home/worker/bin/funsize-balrog-submitter.py \
--artifacts-url-prefix "$PARENT_TASK_ARTIFACTS_URL_PREFIX" \
--manifest "$ARTIFACTS_DIR/manifest.json" \
-a "$BALROG_API_ROOT" \
--sha1-signing-cert "/home/worker/keys/${SHA1_SIGNING_CERT}.pubkey" \
--sha384-signing-cert "/home/worker/keys/${SHA384_SIGNING_CERT}.pubkey" \
--verbose \
"$EXTRA_BALROG_SUBMITTER_PARAMS"

View File

@ -1,66 +0,0 @@
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import site
import os
import logging
import argparse
import json
site.addsitedir("/home/worker/tools/lib/python")
from balrog.submitter.cli import ReleaseSubmitterV4
from util.retry import retry
log = logging.getLogger(__name__)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--manifest", required=True)
parser.add_argument("-a", "--api-root", required=True,
help="Balrog API root")
parser.add_argument("-v", "--verbose", action="store_const",
dest="loglevel", const=logging.DEBUG,
default=logging.INFO)
parser.add_argument("--product", help="Override product name from application.ini")
args = parser.parse_args()
logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s",
level=args.loglevel)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("boto").setLevel(logging.WARNING)
balrog_username = os.environ.get("BALROG_USERNAME")
balrog_password = os.environ.get("BALROG_PASSWORD")
suffix = os.environ.get("BALROG_BLOB_SUFFIX")
if not balrog_username and not balrog_password:
raise RuntimeError("BALROG_USERNAME and BALROG_PASSWORD environment "
"variables should be set")
if not suffix:
raise RuntimeError("BALROG_BLOB_SUFFIX environment variable should be set")
manifest = json.load(open(args.manifest))
auth = (balrog_username, balrog_password)
for e in manifest:
complete_info = [{
"hash": e["hash"],
"size": e["size"],
}]
submitter = ReleaseSubmitterV4(api_root=args.api_root, auth=auth,
suffix=suffix)
productName = args.product or e["appName"]
retry(lambda: submitter.run(
platform=e["platform"], productName=productName,
version=e["toVersion"],
build_number=e["toBuildNumber"],
appVersion=e["version"], extVersion=e["version"],
buildID=e["to_buildid"], locale=e["locale"],
hashFunction='sha512', completeInfo=complete_info),
attempts=30, sleeptime=10, max_sleeptime=60, jitter=3,
)
if __name__ == '__main__':
main()

View File

@ -1,229 +0,0 @@
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import site
import os
import logging
import argparse
import json
import hashlib
import requests
import tempfile
from boto.s3.connection import S3Connection
from mardor.reader import MarReader
from mardor.signing import get_keysize
site.addsitedir("/home/worker/tools/lib/python")
from balrog.submitter.cli import NightlySubmitterV4, ReleaseSubmitterV4
from util.retry import retry, retriable
log = logging.getLogger(__name__)
def get_hash(content, hash_type="md5"):
h = hashlib.new(hash_type)
h.update(content)
return h.hexdigest()
@retriable()
def download(url, dest, mode=None):
log.debug("Downloading %s to %s", url, dest)
r = requests.get(url)
r.raise_for_status()
bytes_downloaded = 0
with open(dest, 'wb') as fd:
for chunk in r.iter_content(4096):
fd.write(chunk)
bytes_downloaded += len(chunk)
log.debug('Downloaded %s bytes', bytes_downloaded)
if 'content-length' in r.headers:
log.debug('Content-Length: %s bytes', r.headers['content-length'])
if bytes_downloaded != int(r.headers['content-length']):
raise IOError('Unexpected number of bytes downloaded')
if mode:
log.debug("chmod %o %s", mode, dest)
os.chmod(dest, mode)
def verify_signature(mar, certs):
log.info("Checking %s signature", mar)
with open(mar, 'rb') as mar_fh:
m = MarReader(mar_fh)
m.verify(verify_key=certs.get(m.signature_type))
def verify_copy_to_s3(bucket_name, aws_access_key_id, aws_secret_access_key,
mar_url, mar_dest, signing_certs):
conn = S3Connection(aws_access_key_id, aws_secret_access_key)
bucket = conn.get_bucket(bucket_name)
_, dest = tempfile.mkstemp()
log.info("Downloading %s to %s...", mar_url, dest)
download(mar_url, dest)
log.info("Verifying the signature...")
if not os.getenv("MOZ_DISABLE_MAR_CERT_VERIFICATION"):
verify_signature(dest, signing_certs)
for name in possible_names(mar_dest, 10):
log.info("Checking if %s already exists", name)
key = bucket.get_key(name)
if not key:
log.info("Uploading to %s...", name)
key = bucket.new_key(name)
# There is a chance for race condition here. To avoid it we check
# the return value with replace=False. It should be not None.
length = key.set_contents_from_filename(dest, replace=False)
if length is None:
log.warn("Name race condition using %s, trying again...", name)
continue
else:
# key.make_public() may lead to race conditions, because
# it doesn't pass version_id, so it may not set permissions
bucket.set_canned_acl(acl_str='public-read', key_name=name,
version_id=key.version_id)
# Use explicit version_id to avoid using "latest" version
return key.generate_url(expires_in=0, query_auth=False,
version_id=key.version_id)
else:
if get_hash(retry(key.get_contents_as_string)) == \
get_hash(open(dest).read()):
log.info("%s has the same MD5 checksum, not uploading...",
name)
return key.generate_url(expires_in=0, query_auth=False,
version_id=key.version_id)
log.info("%s already exists with different checksum, "
"trying another one...", name)
raise RuntimeError("Cannot generate a unique name for %s", mar_dest)
def possible_names(initial_name, amount):
"""Generate names appending counter before extension"""
prefix, ext = os.path.splitext(initial_name)
return [initial_name] + ["{}-{}{}".format(prefix, n, ext) for n in
range(1, amount + 1)]
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--artifacts-url-prefix", required=True,
help="URL prefix for MAR")
parser.add_argument("--manifest", required=True)
parser.add_argument("-a", "--api-root", required=True,
help="Balrog API root")
parser.add_argument("-d", "--dummy", action="store_true",
help="Add '-dummy' suffix to branch name")
parser.add_argument("--sha1-signing-cert", required=True)
parser.add_argument("--sha384-signing-cert", required=True)
parser.add_argument("-v", "--verbose", action="store_const",
dest="loglevel", const=logging.DEBUG,
default=logging.INFO)
parser.add_argument("--product", help="Override product name from application.ini")
args = parser.parse_args()
logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s",
level=args.loglevel)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("boto").setLevel(logging.WARNING)
balrog_username = os.environ.get("BALROG_USERNAME")
balrog_password = os.environ.get("BALROG_PASSWORD")
if not balrog_username and not balrog_password:
raise RuntimeError("BALROG_USERNAME and BALROG_PASSWORD environment "
"variables should be set")
# blob suffix used for releases only
suffix = os.environ.get("BALROG_BLOB_SUFFIX")
s3_bucket = os.environ.get("S3_BUCKET")
aws_access_key_id = os.environ.get("AWS_ACCESS_KEY_ID")
aws_secret_access_key = os.environ.get("AWS_SECRET_ACCESS_KEY")
if not (s3_bucket and aws_access_key_id and aws_secret_access_key):
log.warn("Skipping S3 uploads...")
uploads_enabled = False
else:
uploads_enabled = True
manifest = json.load(open(args.manifest))
auth = (balrog_username, balrog_password)
signing_certs = {
'sha1': open(args.sha1_signing_cert, 'rb').read(),
'sha384': open(args.sha384_signing_cert, 'rb').read(),
}
assert(get_keysize(signing_certs['sha1']) == 2048)
assert(get_keysize(signing_certs['sha384']) == 4096)
for e in manifest:
complete_info = [{
"hash": e["to_hash"],
"size": e["to_size"],
}]
partial_info = [{
"hash": e["hash"],
"size": e["size"],
}]
if "previousVersion" in e and "previousBuildNumber" in e:
log.info("Release style balrog submission")
partial_info[0]["previousVersion"] = e["previousVersion"]
partial_info[0]["previousBuildNumber"] = e["previousBuildNumber"]
submitter = ReleaseSubmitterV4(api_root=args.api_root, auth=auth,
dummy=args.dummy, suffix=suffix)
productName = args.product or e["appName"]
if suffix:
log.warning("Not submitting complete info")
complete_info = None
retry(lambda: submitter.run(
platform=e["platform"], productName=productName,
version=e["toVersion"],
build_number=e["toBuildNumber"],
appVersion=e["version"], extVersion=e["version"],
buildID=e["to_buildid"], locale=e["locale"],
hashFunction='sha512',
partialInfo=partial_info, completeInfo=complete_info),
attempts=30, sleeptime=10, max_sleeptime=60, jitter=3,
)
elif "from_buildid" in e and uploads_enabled:
log.info("Nightly style balrog submission")
partial_mar_url = "{}/{}".format(args.artifacts_url_prefix,
e["mar"])
complete_mar_url = e["to_mar"]
dest_prefix = "{branch}/{buildid}".format(
branch=e["branch"], buildid=e["to_buildid"])
partial_mar_dest = "{}/{}".format(dest_prefix, e["mar"])
complete_mar_filename = "{appName}-{branch}-{version}-" \
"{platform}-{locale}.complete.mar"
complete_mar_filename = complete_mar_filename.format(
appName=e["appName"], branch=e["branch"],
version=e["version"], platform=e["platform"],
locale=e["locale"]
)
complete_mar_dest = "{}/{}".format(dest_prefix,
complete_mar_filename)
partial_info[0]["url"] = verify_copy_to_s3(
s3_bucket, aws_access_key_id, aws_secret_access_key,
partial_mar_url, partial_mar_dest, signing_certs)
complete_info[0]["url"] = verify_copy_to_s3(
s3_bucket, aws_access_key_id, aws_secret_access_key,
complete_mar_url, complete_mar_dest, signing_certs)
partial_info[0]["from_buildid"] = e["from_buildid"]
submitter = NightlySubmitterV4(api_root=args.api_root, auth=auth,
dummy=args.dummy)
productName = args.product or e["appName"]
retry(lambda: submitter.run(
platform=e["platform"], buildID=e["to_buildid"],
productName=productName, branch=e["branch"],
appVersion=e["version"], locale=e["locale"],
hashFunction='sha512', extVersion=e["version"],
partialInfo=partial_info, completeInfo=complete_info),
attempts=30, sleeptime=10, max_sleeptime=60, jitter=3,
)
else:
raise RuntimeError("Cannot determine Balrog submission style")
if __name__ == '__main__':
main()

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -xe
test "$PARENT_TASK_ARTIFACTS_URL_PREFIX"
test "$BALROG_API_ROOT"
# BALROG_BLOB_SUFFIX is used by the script implicitly to avoid possible CLI
# issues with suffixes starting with "-"
test "$BALROG_BLOB_SUFFIX"
ARTIFACTS_DIR="/home/worker/artifacts"
mkdir -p "$ARTIFACTS_DIR"
curl --location --retry 10 --retry-delay 10 -o "$ARTIFACTS_DIR/manifest.json" \
"$PARENT_TASK_ARTIFACTS_URL_PREFIX/manifest.json"
cat "$ARTIFACTS_DIR/manifest.json"
python /home/worker/bin/funsize-balrog-submitter-complete.py \
--manifest "$ARTIFACTS_DIR/manifest.json" \
-a "$BALROG_API_ROOT" \
--verbose \
"$EXTRA_BALROG_SUBMITTER_PARAMS"

View File

@ -19,10 +19,14 @@
#include "mozilla/ipc/Faulty.h"
#include "mozilla/TypeTraits.h"
#include "nsNetCID.h"
#include "nsIEventTarget.h"
#include "nsIFile.h"
#include "nsIFileStreams.h"
#include "nsILineInputStream.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsLocalFile.h"
#include "nsNetCID.h"
#include "nsPrintfCString.h"
#include "nsTArray.h"
#include "nsXULAppAPI.h"
@ -758,10 +762,23 @@ Faulty::IsMessageNameBlacklisted(const char *aMessageName) {
static nsTArray<nsCString> sMessageBlacklist;
if (!sFileLoaded && mBlacklistPath) {
if (ReadFile(mBlacklistPath, sMessageBlacklist) != NS_OK) {
return false;
}
sFileLoaded = true;
/* Run ReadFile() on the main thread to prevent
MOZ_ASSERT(NS_IsMainThread()) in nsStandardURL via nsNetStartup(). */
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"Fuzzer::ReadBlacklistOnMainThread",
[&]() {
if (Faulty::ReadFile(mBlacklistPath, sMessageBlacklist) != NS_OK) {
sFileLoaded = false;
} else {
sFileLoaded = true;
}
}
);
NS_DispatchToMainThread(r.forget(), NS_DISPATCH_SYNC);
}
if (!sFileLoaded) {
return false;
}
if (sMessageBlacklist.Length() == 0) {