mozbrowsersercuritychange event

This commit is contained in:
Paul Rouget 2016-01-22 11:07:51 +01:00
parent fb3fe3d784
commit 63519c3574
13 changed files with 135 additions and 4 deletions

View file

@ -5916,6 +5916,12 @@
"url": "/_mozilla/mozilla/mozbrowser/mozbrowsericonchange_event.html"
}
],
"mozilla/mozbrowser/mozbrowsersecuritychange_event.html": [
{
"path": "mozilla/mozbrowser/mozbrowsersecuritychange_event.html",
"url": "/_mozilla/mozilla/mozbrowser/mozbrowsersecuritychange_event.html"
}
],
"mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html": [
{
"path": "mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html",

View file

@ -0,0 +1,5 @@
[mozbrowsersecuritychange_event.html]
type: testharness
[mozbrowsersecuritychange event is dispatched when content security state changes]
expected: FAIL

View file

@ -0,0 +1,46 @@
<head>
<title>mozbrowsersecuritychange event is dispatched when content security state changes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function(t) {
const HTTP_URL = "http://web-platform.test:8000";
const HTTPS_URL = "https://web-platform.test:8443";
var urls = [ HTTP_URL, HTTPS_URL, HTTP_URL ];
var url_index = 0;
var expectedEvents = [
"insecure",
"secure",
"insecure",
];
var receivedEvents = [];
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = urls[url_index++];
iframe.addEventListener("mozbrowsersecuritychange", t.step_func(e => {
receivedEvents.push(e.detail.state);
if (receivedEvents.length == expectedEvents.length) {
assert_array_equals(receivedEvents, expectedEvents);
t.done();
} else {
iframe.src = urls[url_index++];
}
}));
document.body.appendChild(iframe);
});
</script>
</body>