зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to inbound, a=merge CLOSED TREE
This commit is contained in:
Коммит
f11c79a662
|
@ -104,7 +104,7 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
|||
}
|
||||
|
||||
size_t
|
||||
MediaEngineGonkVideoSource::NumCapabilities()
|
||||
MediaEngineGonkVideoSource::NumCapabilities() const
|
||||
{
|
||||
// TODO: Stop hardcoding. Use GetRecorderProfiles+GetProfileInfo (Bug 1128550)
|
||||
//
|
||||
|
@ -150,13 +150,16 @@ nsresult
|
|||
MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs,
|
||||
const nsString& aDeviceId,
|
||||
const nsACString& aOrigin)
|
||||
const nsACString& aOrigin,
|
||||
BaseAllocationHandle** aOutHandle,
|
||||
const char** aOutBadConstraint)
|
||||
{
|
||||
LOG((__FUNCTION__));
|
||||
|
||||
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
|
||||
if (mState == kReleased && mInitDone) {
|
||||
ChooseCapability(aConstraints, aPrefs, aDeviceId);
|
||||
NormalizedConstraints constraints(aConstraints);
|
||||
ChooseCapability(constraints, aPrefs, aDeviceId);
|
||||
NS_DispatchToMainThread(WrapRunnable(RefPtr<MediaEngineGonkVideoSource>(this),
|
||||
&MediaEngineGonkVideoSource::AllocImpl));
|
||||
mCallbackMonitor.Wait();
|
||||
|
@ -165,13 +168,17 @@ MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstrai
|
|||
}
|
||||
}
|
||||
|
||||
aOutHandle = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaEngineGonkVideoSource::Deallocate()
|
||||
MediaEngineGonkVideoSource::Deallocate(BaseAllocationHandle* aHandle)
|
||||
{
|
||||
LOG((__FUNCTION__));
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(!aHandle);
|
||||
|
||||
bool empty;
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
|
@ -332,9 +339,11 @@ MediaEngineGonkVideoSource::Stop(SourceMediaStream* aSource, TrackID aID)
|
|||
}
|
||||
|
||||
nsresult
|
||||
MediaEngineGonkVideoSource::Restart(const dom::MediaTrackConstraints& aConstraints,
|
||||
MediaEngineGonkVideoSource::Restart(BaseAllocationHandle* aHandle,
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs,
|
||||
const nsString& aDeviceId)
|
||||
const nsString& aDeviceId,
|
||||
const char** aOutBadConstraint)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -384,7 +393,7 @@ MediaEngineGonkVideoSource::Shutdown()
|
|||
}
|
||||
|
||||
if (mState == kAllocated || mState == kStopped) {
|
||||
Deallocate();
|
||||
Deallocate(nullptr);
|
||||
}
|
||||
|
||||
mState = kReleased;
|
||||
|
|
|
@ -63,14 +63,18 @@ public:
|
|||
nsresult Allocate(const dom::MediaTrackConstraints &aConstraints,
|
||||
const MediaEnginePrefs &aPrefs,
|
||||
const nsString& aDeviceId,
|
||||
const nsACString& aOrigin) override;
|
||||
nsresult Deallocate() override;
|
||||
const nsACString& aOrigin,
|
||||
BaseAllocationHandle** aOutHandle,
|
||||
const char** aOutBadConstraint) override;
|
||||
nsresult Deallocate(BaseAllocationHandle* aHandle) override;
|
||||
nsresult Start(SourceMediaStream* aStream, TrackID aID,
|
||||
const PrincipalHandle& aPrincipalHandle) override;
|
||||
nsresult Stop(SourceMediaStream* aSource, TrackID aID) override;
|
||||
nsresult Restart(const dom::MediaTrackConstraints& aConstraints,
|
||||
nsresult Restart(BaseAllocationHandle* aHandle,
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs &aPrefs,
|
||||
const nsString& aDeviceId) override;
|
||||
const nsString& aDeviceId,
|
||||
const char** aOutBadConstraint) override;
|
||||
void NotifyPull(MediaStreamGraph* aGraph,
|
||||
SourceMediaStream* aSource,
|
||||
TrackID aId,
|
||||
|
@ -114,7 +118,7 @@ protected:
|
|||
// Initialize the needed Video engine interfaces.
|
||||
void Init();
|
||||
void Shutdown();
|
||||
size_t NumCapabilities() override;
|
||||
size_t NumCapabilities() const override;
|
||||
// Initialize the recording frame (MediaBuffer) callback and Gonk camera.
|
||||
// MediaBuffer will transfers to MediaStreamGraph via AppendToTrack.
|
||||
nsresult InitDirectMediaBuffer();
|
||||
|
|
|
@ -50,7 +50,7 @@ UploadStumbleRunnable::Upload()
|
|||
rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr, nullptr);
|
||||
rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURLFormatter> formatter =
|
||||
|
|
|
@ -259,28 +259,18 @@ SandboxInfo::ThreadingCheck()
|
|||
SandboxInfo::SubmitTelemetry()
|
||||
{
|
||||
SandboxInfo sandboxInfo = Get();
|
||||
if (sandboxInfo.Test(SandboxInfo::kHasSeccompBPF)) {
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_CAPABILITIES_SECCOMP_BPF, true);
|
||||
}
|
||||
if (sandboxInfo.Test(SandboxInfo::kHasSeccompTSync)) {
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_CAPABILITIES_SECCOMP_TSYNC, true);
|
||||
}
|
||||
if (sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces)) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SANDBOX_CAPABILITIES_USER_NAMESPACES_PRIVILEGED, true);
|
||||
}
|
||||
if (sandboxInfo.Test(SandboxInfo::kHasUserNamespaces)) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SANDBOX_CAPABILITIES_USER_NAMESPACES, true);
|
||||
}
|
||||
if (sandboxInfo.Test(SandboxInfo::kEnabledForContent)) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SANDBOX_CAPABILITIES_ENABLED_CONTENT, true);
|
||||
}
|
||||
if (sandboxInfo.Test(SandboxInfo::kEnabledForMedia)) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SANDBOX_CAPABILITIES_ENABLED_MEDIA, true);
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_BPF,
|
||||
sandboxInfo.Test(SandboxInfo::kHasSeccompBPF));
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_TSYNC,
|
||||
sandboxInfo.Test(SandboxInfo::kHasSeccompTSync));
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED,
|
||||
sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces));
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES,
|
||||
sandboxInfo.Test(SandboxInfo::kHasUserNamespaces));
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_CONTENT_ENABLED,
|
||||
sandboxInfo.Test(SandboxInfo::kEnabledForContent));
|
||||
Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
|
||||
sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -6,7 +6,6 @@ import base64
|
|||
import hashlib
|
||||
import imghdr
|
||||
import struct
|
||||
import time
|
||||
import urllib
|
||||
|
||||
from unittest import skip
|
||||
|
@ -87,16 +86,21 @@ class Chrome(ScreenCaptureTestCase):
|
|||
# <window> element, which does not exist for secondary windows.
|
||||
def test_secondary_windows(self):
|
||||
ss = self.marionette.screenshot()
|
||||
self.marionette.execute_script("""
|
||||
window.open('chrome://marionette/content/doesnotexist.xul',
|
||||
self.marionette.execute_async_script("""
|
||||
win = window.open('chrome://marionette/content/doesnotexist.xul',
|
||||
'foo',
|
||||
'chrome');
|
||||
|
||||
// Bug 1288339 - We don't wait for readyState to be complete yet
|
||||
waitForWindow = function() {
|
||||
if (win.document.readyState != 'complete') {
|
||||
win.setTimeout(this, 100);
|
||||
}
|
||||
|
||||
marionetteScriptFinished(true);
|
||||
}()
|
||||
""")
|
||||
self.marionette.switch_to_window("foo")
|
||||
# there can be a race between opening and registering the window
|
||||
# and switching to it. Waiting a tiny amount of time is enough not to
|
||||
# break anything.
|
||||
time.sleep(0.002)
|
||||
ss = self.marionette.screenshot()
|
||||
size = self.get_image_dimensions(ss)
|
||||
self.assert_png(ss)
|
||||
|
|
|
@ -9856,51 +9856,51 @@
|
|||
"kind": "boolean",
|
||||
"description": "Result of call to SandboxBroker::Initialize"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_SECCOMP_BPF": {
|
||||
"SANDBOX_HAS_SECCOMP_BPF": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether the system has seccomp-bpf capability"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_SECCOMP_TSYNC": {
|
||||
"SANDBOX_HAS_SECCOMP_TSYNC": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether the system has seccomp-bpf thread-sync capability"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_USER_NAMESPACES": {
|
||||
"SANDBOX_HAS_USER_NAMESPACES": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether our process succedeed in creating a user namespace"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_USER_NAMESPACES_PRIVILEGED": {
|
||||
"SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether the system has the capability to create privileged user namespaces"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_ENABLED_MEDIA": {
|
||||
"SANDBOX_MEDIA_ENABLED": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether the sandbox is enabled for media/GMP plugins"
|
||||
},
|
||||
"SANDBOX_CAPABILITIES_ENABLED_CONTENT": {
|
||||
"SANDBOX_CONTENT_ENABLED": {
|
||||
"alert_emails": ["gcp@mozilla.com"],
|
||||
"bug_numbers": [1098428],
|
||||
"expires_in_version": "55",
|
||||
"kind": "flag",
|
||||
"kind": "boolean",
|
||||
"cpp_guard": "XP_LINUX",
|
||||
"description": "Whether the sandbox is enabled for the content process"
|
||||
},
|
||||
|
|
|
@ -41,13 +41,9 @@ const APIBroker = {
|
|||
return;
|
||||
}
|
||||
|
||||
let { resolve, reject } = this._promises.get(payload.callbackID);
|
||||
let resolve = this._promises.get(payload.callbackID);
|
||||
this._promises.delete(payload.callbackID);
|
||||
|
||||
if ("resolve" in payload)
|
||||
resolve(payload.resolve);
|
||||
else
|
||||
reject(payload.reject);
|
||||
resolve(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -71,10 +67,10 @@ const APIBroker = {
|
|||
},
|
||||
|
||||
sendRequest: function(type, ...args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
let callbackID = this._nextID++;
|
||||
|
||||
this._promises.set(callbackID, { resolve, reject });
|
||||
this._promises.set(callbackID, resolve);
|
||||
Services.cpmm.sendAsyncMessage(MSG_PROMISE_REQUEST, { type, callbackID, args });
|
||||
});
|
||||
},
|
||||
|
@ -120,41 +116,59 @@ function AddonInstall(window, properties) {
|
|||
}
|
||||
|
||||
/**
|
||||
* API methods should return promises from the page, this is a simple wrapper
|
||||
* to make sure of that. It also automatically wraps objects when necessary.
|
||||
* API methods all return promises from content. They also follow a
|
||||
* similar pattern of sending a request to the parent process, then
|
||||
* wrapping the returned object or error appropriately for the page.
|
||||
* We must take care only to wrap and reject with errors that are meant
|
||||
* to be visible to content, and not internal errors.
|
||||
* This function is a wrapper to handle the common bits.
|
||||
*
|
||||
* apiRequest is the name of the command to invoke in the parent process
|
||||
* apiArgs is a callable that takes the content-provided args for the
|
||||
* method and returns the arguments to send in the request to
|
||||
* the parent process.
|
||||
* if processor is non-null, it is called on the returned object to
|
||||
* convert the result from the parent process back to an
|
||||
* object appropriate for content.
|
||||
*
|
||||
* Both apiArgs and processor are called with "this" bound to the value
|
||||
* that is held when the actual api method was called.
|
||||
*/
|
||||
function WebAPITask(generator) {
|
||||
function WebAPITask(apiRequest, apiArgs, processor) {
|
||||
return function(...args) {
|
||||
let task = Task.async(generator.bind(this));
|
||||
|
||||
let win = this.window;
|
||||
|
||||
let wrapForContent = (obj) => {
|
||||
if (obj instanceof Addon) {
|
||||
return win.Addon._create(win, obj);
|
||||
}
|
||||
if (obj instanceof AddonInstall) {
|
||||
return win.AddonInstall._create(win, obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
let boundApiArgs = apiArgs.bind(this);
|
||||
let boundProcessor = processor ? processor.bind(this) : null;
|
||||
|
||||
return new win.Promise((resolve, reject) => {
|
||||
task(...args).then(wrapForContent)
|
||||
.then(resolve, reject);
|
||||
Task.spawn(function* () {
|
||||
let sendArgs = boundApiArgs(...args);
|
||||
let result = yield APIBroker.sendRequest(apiRequest, ...sendArgs);
|
||||
if ("reject" in result) {
|
||||
let err = new win.Error(result.reject.message);
|
||||
// We don't currently put any other properties onto Errors
|
||||
// generated by mozAddonManager. If/when we do, they will
|
||||
// need to get copied here.
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
let obj = result.resolve;
|
||||
if (boundProcessor) {
|
||||
obj = boundProcessor(obj);
|
||||
}
|
||||
resolve(obj);
|
||||
}).catch(err => {
|
||||
Cu.reportError(err);
|
||||
reject(new win.Error("Unexpected internal error"));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Addon.prototype = {
|
||||
uninstall: WebAPITask(function*() {
|
||||
return yield APIBroker.sendRequest("addonUninstall", this.id);
|
||||
}),
|
||||
|
||||
setEnabled: WebAPITask(function* (value) {
|
||||
return yield APIBroker.sendRequest("addonSetEnabled", this.id, value);
|
||||
}),
|
||||
uninstall: WebAPITask("addonUninstall", function() { return [this.id]; }),
|
||||
setEnabled: WebAPITask("addonSetEnabled", function(value) {return [this.id, value]; }),
|
||||
};
|
||||
|
||||
const INSTALL_EVENTS = [
|
||||
|
@ -181,13 +195,8 @@ AddonInstall.prototype = {
|
|||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
},
|
||||
|
||||
install: WebAPITask(function*() {
|
||||
yield APIBroker.sendRequest("addonInstallDoInstall", this.id);
|
||||
}),
|
||||
|
||||
cancel: WebAPITask(function*() {
|
||||
yield APIBroker.sendRequest("addonInstallCancel", this.id);
|
||||
}),
|
||||
install: WebAPITask("addonInstallDoInstall", function() { return [this.id]; }),
|
||||
cancel: WebAPITask("addonInstallCancel", function() { return [this.id]; }),
|
||||
};
|
||||
|
||||
function WebAPI() {
|
||||
|
@ -204,19 +213,21 @@ WebAPI.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
getAddonByID: WebAPITask(function*(id) {
|
||||
let addonInfo = yield APIBroker.sendRequest("getAddonByID", id);
|
||||
return addonInfo ? new Addon(this.window, addonInfo) : null;
|
||||
getAddonByID: WebAPITask("getAddonByID", id => [id], function(addonInfo) {
|
||||
if (!addonInfo) {
|
||||
return null;
|
||||
}
|
||||
let addon = new Addon(this.window, addonInfo);
|
||||
return this.window.Addon._create(this.window, addon);
|
||||
}),
|
||||
|
||||
createInstall: WebAPITask(function*(options) {
|
||||
let installInfo = yield APIBroker.sendRequest("createInstall", options);
|
||||
createInstall: WebAPITask("createInstall", options => [options], function(installInfo) {
|
||||
if (!installInfo) {
|
||||
return null;
|
||||
}
|
||||
let install = new AddonInstall(this.window, installInfo);
|
||||
this.allInstalls.push(installInfo.id);
|
||||
return install;
|
||||
return this.window.AddonInstall._create(this.window, install);
|
||||
}),
|
||||
|
||||
eventListenerWasAdded(type) {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsTArray.h"
|
||||
#include "pixelflinger/format.h"
|
||||
#include "nsIDisplayInfo.h"
|
||||
#include "base/task.h"
|
||||
|
||||
#if ANDROID_VERSION >= 17
|
||||
#include "libdisplay/DisplaySurface.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче