зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1278205 - use preference for exposing presentation API. r=smaug.
MozReview-Commit-ID: AXkZmPe9J6k --HG-- extra : rebase_source : 4edf7b15349f235f0f655edadbce340b22a6abf7
This commit is contained in:
Родитель
98df436e16
Коммит
5695b2c3e7
|
@ -482,11 +482,6 @@ this.PermissionsTable = { geolocation: {
|
|||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"presentation": {
|
||||
app: DENY_ACTION,
|
||||
privileged: ALLOW_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"open-hidden-window": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
|
|
|
@ -2331,58 +2331,6 @@ Navigator::HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
JS::Rooted<JSObject*> global(aCx, aGlobal);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> inner = GetWindowFromGlobal(global);
|
||||
if (NS_WARN_IF(!inner)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Grant access if it has the permission.
|
||||
if (CheckPermission(inner, "presentation")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Grant access to browser receiving pages and their same-origin iframes. (App
|
||||
// pages should be controlled by "presentation" permission in app manifests.)
|
||||
nsCOMPtr<nsIDocShell> docshell = inner->GetDocShell();
|
||||
if (!docshell) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!docshell->GetIsInMozBrowserOrApp()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString presentationURL;
|
||||
nsContentUtils::GetPresentationURL(docshell, presentationURL);
|
||||
|
||||
if (presentationURL.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> securityManager =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
|
||||
if (!securityManager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> presentationURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(presentationURI), presentationURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> docURI = inner->GetDocumentURI();
|
||||
return NS_SUCCEEDED(securityManager->CheckSameOriginURI(presentationURI,
|
||||
docURI,
|
||||
false));
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
|
|
|
@ -323,8 +323,6 @@ public:
|
|||
static bool HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
#endif
|
||||
|
||||
static bool HasPresentationSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
static bool IsE10sEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
nsPIDOMWindowInner* GetParentObject() const
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPresentationService.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "PresentationReceiver.h"
|
||||
|
@ -37,6 +40,53 @@ Presentation::Create(nsPIDOMWindowInner* aWindow)
|
|||
return presentation.forget();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
Presentation::HasReceiverSupport(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
JS::Rooted<JSObject*> global(aCx, aGlobal);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> inner =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(global));
|
||||
if (NS_WARN_IF(!inner)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Grant access to browser receiving pages and their same-origin iframes. (App
|
||||
// pages should be controlled by "presentation" permission in app manifests.)
|
||||
nsCOMPtr<nsIDocShell> docshell = inner->GetDocShell();
|
||||
if (!docshell) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!docshell->GetIsInMozBrowserOrApp()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString presentationURL;
|
||||
nsContentUtils::GetPresentationURL(docshell, presentationURL);
|
||||
|
||||
if (presentationURL.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> securityManager =
|
||||
nsContentUtils::GetSecurityManager();
|
||||
if (!securityManager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> presentationURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(presentationURI), presentationURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> docURI = inner->GetDocumentURI();
|
||||
return NS_SUCCEEDED(securityManager->CheckSameOriginURI(presentationURI,
|
||||
docURI,
|
||||
false));
|
||||
}
|
||||
|
||||
Presentation::Presentation(nsPIDOMWindowInner* aWindow)
|
||||
: DOMEventTargetHelper(aWindow)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
static already_AddRefed<Presentation> Create(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
static bool HasReceiverSupport(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for B2G PresentationReceiver on a non-receiver page at receiver side (OOP)</title>
|
||||
<title>Test for B2G PresentationReceiver on a non-receiver page at receiver side</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
|
@ -28,7 +28,7 @@ function finish() {
|
|||
|
||||
function testConnectionAvailable() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
ok(!navigator.presentation, "navigator.presentation shouldn't be available in non-receiving OOP pages.");
|
||||
ok(!navigator.presentation.receiver, "navigator.presentation.receiver shouldn't be available in non-receiving pages.");
|
||||
aResolve();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for B2G PresentationReceiver on a non-receiver inner iframe of the receiver page at receiver side (OOP)</title>
|
||||
<title>Test for B2G PresentationReceiver on a non-receiver inner iframe of the receiver page at receiver side</title>
|
||||
</head>
|
||||
<body onload="testConnectionAvailable()">
|
||||
<div id="content"></div>
|
||||
|
@ -16,7 +16,7 @@ function ok(a, msg) {
|
|||
|
||||
function testConnectionAvailable() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
ok(!navigator.presentation, "navigator.presentation shouldn't be available in inner iframes with different origins from receiving OOP pages.");
|
||||
ok(!navigator.presentation.receiver, "navigator.presentation.receiver shouldn't be available in inner iframes with different origins from receiving pages.");
|
||||
aResolve();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for B2G PresentationReceiver at receiver side (OOP)</title>
|
||||
<title>Test for B2G PresentationReceiver at receiver side</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
|
@ -34,8 +34,8 @@ var connection;
|
|||
|
||||
function testConnectionAvailable() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
ok(navigator.presentation, "navigator.presentation should be available in OOP receiving pages.");
|
||||
ok(navigator.presentation.receiver, "navigator.presentation.receiver should be available in OOP receiving pages.");
|
||||
ok(navigator.presentation, "navigator.presentation should be available in receiving pages.");
|
||||
ok(navigator.presentation.receiver, "navigator.presentation.receiver should be available in receiving pages.");
|
||||
|
||||
navigator.presentation.receiver.connectionList.then(
|
||||
function(aList) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for B2G PresentationReceiver in an inner iframe of the receiver page at receiver side (OOP)</title>
|
||||
<title>Test for B2G PresentationReceiver in an inner iframe of the receiver page at receiver side</title>
|
||||
</head>
|
||||
<body onload="testConnectionAvailable()">
|
||||
<div id="content"></div>
|
||||
|
@ -16,7 +16,7 @@ function ok(a, msg) {
|
|||
|
||||
function testConnectionAvailable() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
ok(navigator.presentation, "navigator.presentation should be available in same-origin inner iframes of receiving OOP pages.");
|
||||
ok(navigator.presentation.receiver, "navigator.presentation.receiver should be available in same-origin inner iframes of receiving pages.");
|
||||
aResolve();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,12 +14,6 @@ var connection;
|
|||
var receiverIframe;
|
||||
|
||||
function setup() {
|
||||
SpecialPowers.addPermission("presentation",
|
||||
true, { url: receiverUrl,
|
||||
originAttributes: {
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
inIsolatedMozBrowser: true }});
|
||||
|
||||
gScript.addMessageListener('device-prompt', function devicePromptHandler() {
|
||||
debug('Got message: device-prompt');
|
||||
gScript.removeMessageListener('device-prompt', devicePromptHandler);
|
||||
|
@ -154,11 +148,6 @@ function teardown() {
|
|||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
SpecialPowers.removePermission("presentation",
|
||||
{ url: receiverUrl,
|
||||
originAttributes: {
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
inIsolatedMozBrowser: true }});
|
||||
gScript.sendAsyncMessage('teardown');
|
||||
}
|
||||
|
||||
|
@ -171,10 +160,11 @@ function runTests() {
|
|||
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: "browser", allow: true, context: document},
|
||||
], () => {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.test.enabled", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.tabs.disabled", false],
|
||||
|
|
|
@ -279,12 +279,13 @@ SimpleTest.waitForExplicitFinish();
|
|||
SimpleTest.requestFlakyTimeout('Test for guarantee not firing async event');
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: "browser", allow: true, context: document},
|
||||
], () => {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
/* Mocked TCP session transport builder in the test */
|
||||
["dom.presentation.session_transport.data_channel.enable", false],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.test.enabled", true],
|
||||
["dom.presentation.test.stage", 0],
|
||||
["dom.mozBrowserFramesEnabled", true]]},
|
||||
|
|
|
@ -125,10 +125,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: "browser", allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", true],
|
||||
["dom.mozBrowserFramesEnabled", true]]},
|
||||
runTests);
|
||||
|
|
|
@ -195,10 +195,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.browser_frames.oop_by_default", true],
|
||||
|
|
|
@ -253,9 +253,9 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", true]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -69,10 +69,9 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "presentation-device-manage", allow: false, context: document},
|
||||
{type: "presentation", allow: true, context: document},
|
||||
{type: "presentation", allow: true, context: iframe.contentDocument},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ "set": [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -65,10 +65,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "presentation-device-manage", allow: false, context: document},
|
||||
{type: "presentation", allow: true, context: document},
|
||||
{type: "browser", allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ "set": [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
|
|
|
@ -365,10 +365,10 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: "presentation", allow: true, context: iframe.contentDocument},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", true]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -62,10 +62,10 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "presentation-device-manage", allow: false, context: document},
|
||||
{type: "presentation", allow: true, context: document},
|
||||
{type: "presentation", allow: true, context: iframe.contentDocument},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ "set": [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", false],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -173,9 +173,10 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", false],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -162,6 +162,7 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.test.enabled", true],
|
||||
["dom.presentation.test.stage", 0]]},
|
||||
runTests);
|
||||
|
|
|
@ -121,10 +121,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
|
|
|
@ -95,10 +95,10 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: "browser", allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false],
|
||||
["dom.mozBrowserFramesEnabled", true]]},
|
||||
runTests);
|
||||
|
|
|
@ -68,9 +68,9 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false],
|
||||
["presentation.receiver.loading.timeout", 10]]},
|
||||
runTests);
|
||||
|
|
|
@ -75,10 +75,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
['dom.presentation.session_transport.data_channel.enable', false],
|
||||
['dom.mozBrowserFramesEnabled', true],
|
||||
['dom.ipc.tabs.disabled', false]]},
|
||||
|
|
|
@ -161,10 +161,11 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.browser_frames.oop_by_default", true]]},
|
||||
|
|
|
@ -250,6 +250,7 @@ function runTests() {
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ function runTests() {
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
|
||||
|
|
|
@ -147,9 +147,9 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -394,9 +394,9 @@ function runTests() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
|
|
@ -217,10 +217,11 @@ function runTests() {
|
|||
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], () => {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
['dom.presentation.test.enabled', true],
|
||||
['dom.mozBrowserFramesEnabled', true],
|
||||
['dom.ipc.tabs.disabled', false],
|
||||
|
|
|
@ -173,10 +173,11 @@ function runTests() {
|
|||
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: 'presentation-device-manage', allow: false, context: document},
|
||||
{type: 'presentation', allow: true, context: document},
|
||||
{type: 'browser', allow: true, context: document},
|
||||
], () => {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [['dom.presentation.enabled', true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.receiver.enabled", true],
|
||||
['dom.presentation.test.enabled', true],
|
||||
['dom.mozBrowserFramesEnabled', true],
|
||||
['dom.ipc.tabs.disabled', false],
|
||||
|
|
|
@ -947,15 +947,21 @@ var interfaceNamesInGlobalScope =
|
|||
disabled: true,
|
||||
permission: ["presentation-device-manage"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "Presentation", disabled: true, permission: ["presentation"]},
|
||||
{name: "Presentation", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationAvailability", disabled: true, permission: ["presentation"]},
|
||||
{name: "PresentationAvailability", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationRequest", disabled: true, permission: ["presentation"]},
|
||||
{name: "PresentationConnection", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationSession", disabled: true, permission: ["presentation"]},
|
||||
{name: "PresentationConnectionAvailableEvent", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationSessionConnectEvent", disabled: true, permission: ["presentation"]},
|
||||
{name: "PresentationConnectionClosedEvent", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationConnectionList", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationReceiver", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PresentationRequest", disabled: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"ProcessingInstruction",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -431,7 +431,7 @@ partial interface Navigator {
|
|||
};
|
||||
|
||||
partial interface Navigator {
|
||||
[Throws, Pref="dom.presentation.enabled", Func="Navigator::HasPresentationSupport", SameObject]
|
||||
[Throws, Pref="dom.presentation.enabled", SameObject]
|
||||
readonly attribute Presentation? presentation;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
[Pref="dom.presentation.enabled"]
|
||||
interface Presentation : EventTarget {
|
||||
/*
|
||||
* This should be used by the UA as the default presentation request for the
|
||||
|
@ -15,12 +14,15 @@ interface Presentation : EventTarget {
|
|||
*
|
||||
* Only used by controlling browsing context (senders).
|
||||
*/
|
||||
[Pref="dom.presentation.controller.enabled"]
|
||||
attribute PresentationRequest? defaultRequest;
|
||||
|
||||
/*
|
||||
* This should be available on the receiving browsing context in order to
|
||||
* access the controlling browsing context and communicate with them.
|
||||
*/
|
||||
[SameObject]
|
||||
[SameObject,
|
||||
Pref="dom.presentation.receiver.enabled",
|
||||
Func="Presentation::HasReceiverSupport"]
|
||||
readonly attribute PresentationReceiver? receiver;
|
||||
};
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
[Pref="dom.presentation.controller.enabled"]
|
||||
interface PresentationAvailability : EventTarget {
|
||||
/*
|
||||
* If there is at least one device discovered by UA, the value is |true|.
|
||||
|
|
|
@ -20,8 +20,7 @@ enum PresentationConnectionState
|
|||
"terminated"
|
||||
};
|
||||
|
||||
[Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
[Pref="dom.presentation.enabled"]
|
||||
interface PresentationConnection : EventTarget {
|
||||
/*
|
||||
* Unique id for all existing connections.
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
[Constructor(DOMString type,
|
||||
PresentationConnectionAvailableEventInit eventInitDict),
|
||||
Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
Pref="dom.presentation.enabled"]
|
||||
interface PresentationConnectionAvailableEvent : Event
|
||||
{
|
||||
[SameObject]
|
||||
|
|
|
@ -20,8 +20,7 @@ enum PresentationConnectionClosedReason
|
|||
|
||||
[Constructor(DOMString type,
|
||||
PresentationConnectionClosedEventInit eventInitDict),
|
||||
Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
Pref="dom.presentation.enabled"]
|
||||
interface PresentationConnectionClosedEvent : Event
|
||||
{
|
||||
readonly attribute PresentationConnectionClosedReason reason;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
[Pref="dom.presentation.receiver.enabled"]
|
||||
interface PresentationConnectionList : EventTarget {
|
||||
/*
|
||||
* Return the non-terminated set of presentation connections in the
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
[Pref="dom.presentation.receiver.enabled"]
|
||||
interface PresentationReceiver {
|
||||
/*
|
||||
* Get a list which contains all connected presentation connections
|
||||
|
@ -13,4 +12,4 @@ interface PresentationReceiver {
|
|||
*/
|
||||
[SameObject, Throws]
|
||||
readonly attribute Promise<PresentationConnectionList> connectionList;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
*/
|
||||
|
||||
[Constructor(DOMString url),
|
||||
Pref="dom.presentation.enabled",
|
||||
Func="Navigator::HasPresentationSupport"]
|
||||
Pref="dom.presentation.controller.enabled"]
|
||||
interface PresentationRequest : EventTarget {
|
||||
/*
|
||||
* A requesting page use start() to start a new connection, and it will be
|
||||
|
|
|
@ -913,7 +913,7 @@ pref("identity.fxaccounts.remote.oauth.uri", "https://oauth.accounts.firefox.com
|
|||
pref("identity.sync.tokenserver.uri", "https://token.services.mozilla.com/1.0/sync/1.5");
|
||||
|
||||
// Enable Presentation API
|
||||
pref("dom.presentation.enabled", true);
|
||||
pref("dom.presentation.enabled", false);
|
||||
pref("dom.presentation.discovery.enabled", true);
|
||||
pref("dom.presentation.discovery.legacy.enabled", true); // for TV 2.5 backward capability
|
||||
|
||||
|
|
|
@ -5256,6 +5256,10 @@ pref("dom.beforeAfterKeyboardEvent.enabled", false);
|
|||
|
||||
// Presentation API
|
||||
pref("dom.presentation.enabled", false);
|
||||
pref("dom.presentation.controller.enabled", false);
|
||||
pref("dom.presentation.receiver.enabled", false);
|
||||
|
||||
// Presentation Device
|
||||
pref("dom.presentation.tcp_server.debug", false);
|
||||
pref("dom.presentation.discovery.enabled", false);
|
||||
pref("dom.presentation.discovery.legacy.enabled", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче