fune/browser/base/content/test/permissions/permissions.html
Kearwood Kip Gilbert 19ba3b0322 Bug 1580567 - Implement XR device access permission UI r=fluent-reviewers,bzbarsky,pbz,daoshengmu,imanol
Added @rbarker as a reviewer to check if this will work well within GeckoView for FxR / Android.
Added @bzbarsky for test_interfaces.html.  -- I'd like to re-land the secure origin requirement for WebVR as part of this patch, as it doesn't help to have UI that can't guarantee the identity of the origin.  (This was backed out due to test failures originally, and since been fixed)

Differential Revision: https://phabricator.services.mozilla.com/D45951

--HG--
rename : browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js => browser/components/privatebrowsing/test/browser/browser_privatebrowsing_rememberprompt.js
extra : moz-landing-system : lando
2019-12-12 03:10:51 +00:00

49 lines
1.5 KiB
HTML

<!DOCTYPE HTML>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html dir="ltr" xml:lang="en-US" lang="en-US">
<head>
<meta charset="utf8">
</head>
<script>
var gKeyDowns = 0;
var gKeyPresses = 0;
navigator.serviceWorker.register("dummy.js");
function requestPush() {
return navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
serviceWorkerRegistration.pushManager.subscribe();
});
}
function requestGeo() {
return navigator.geolocation.getCurrentPosition(() => {
parent.postMessage("allow", "*");
}, error => {
// PERMISSION_DENIED = 1
parent.postMessage(error.code == 1 ? "deny" : "allow", "*");
});
}
window.onmessage = function(event) {
switch (event.data) {
case "push":
requestPush();
break;
}
};
</script>
<body onkeydown="gKeyDowns++;" onkeypress="gKeyPresses++">
<!-- This page could eventually request permissions from content
and make sure that chrome responds appropriately -->
<button id="geo" onclick="requestGeo()">Geolocation</button>
<button id="xr" onclick="navigator.getVRDisplays()">XR</button>
<button id="desktop-notification" onclick="Notification.requestPermission()">Notifications</button>
<button id="push" onclick="requestPush()">Push Notifications</button>
<button id="camera" onclick="navigator.mediaDevices.getUserMedia({video: true, fake: true})">Camera</button>
</body>
</html>