mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-16 12:17:34 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test default request for B2G Presentation API at sender side</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1268758">Test allow-presentation sandboxing flag</a>
|
||||
<iframe id="iframe" src="https://example.com/tests/dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html"></iframe>
|
||||
<script type="application/javascript;version=1.8">
|
||||
|
||||
"use strict";
|
||||
|
||||
var iframe = document.getElementById("iframe");
|
||||
var readyToStart = false;
|
||||
var testSetuped = false;
|
||||
|
||||
function setup() {
|
||||
SpecialPowers.addPermission("presentation",
|
||||
true, { url: "https://example.com/tests/dom/presentation/tests/mochitest/file_presentation_mixed_security_contexts.html",
|
||||
originAttributes: {
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
inIsolatedMozBrowser: false }});
|
||||
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
addEventListener("message", function listener(event) {
|
||||
var message = event.data;
|
||||
if (/^OK /.exec(message)) {
|
||||
ok(true, message.replace(/^OK /, ""));
|
||||
} else if (/^KO /.exec(message)) {
|
||||
ok(false, message.replace(/^KO /, ""));
|
||||
} else if (/^INFO /.exec(message)) {
|
||||
info(message.replace(/^INFO /, ""));
|
||||
} else if (/^COMMAND /.exec(message)) {
|
||||
var command = JSON.parse(message.replace(/^COMMAND /, ""));
|
||||
if (command === "ready-to-start") {
|
||||
readyToStart = true;
|
||||
startTest();
|
||||
}
|
||||
} else if (/^DONE$/.exec(message)) {
|
||||
window.removeEventListener('message', listener);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
testSetuped = true;
|
||||
aResolve();
|
||||
});
|
||||
}
|
||||
|
||||
iframe.onload = startTest();
|
||||
|
||||
function startTest() {
|
||||
if (!(testSetuped && readyToStart)) {
|
||||
return;
|
||||
}
|
||||
iframe.contentWindow.postMessage("start", "*");
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
ok(navigator.presentation, "navigator.presentation should be available.");
|
||||
setup().then(startTest);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "presentation-device-manage", allow: false, context: document},
|
||||
], function() {
|
||||
SpecialPowers.pushPrefEnv({ "set": [["dom.presentation.enabled", true],
|
||||
["dom.presentation.controller.enabled", true],
|
||||
["dom.presentation.session_transport.data_channel.enable", false]]},
|
||||
runTests);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue