Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the public domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Bug 763694 - Test that <iframe mozbrowser> delivers proper
5 // mozbrowsersecuritychange events.
7 "use strict";
8 SimpleTest.waitForExplicitFinish();
9 browserElementTestHelpers.setEnabledPref(true);
10 browserElementTestHelpers.addPermission();
12 function runTest() {
13 var iframe = document.createElement('iframe');
14 SpecialPowers.wrap(iframe).mozbrowser = true;
16 var lastSecurityState;
17 iframe.addEventListener('mozbrowsersecuritychange', function(e) {
18 lastSecurityState = e.detail;
19 });
21 var filepath = 'tests/dom/browser-element/mochitest/file_browserElement_SecurityChange.html';
23 var count = 0;
24 iframe.addEventListener('mozbrowserloadend', function(e) {
25 count++;
26 var nextURL;
27 switch (count) {
28 case 1:
29 is(lastSecurityState.state, 'secure');
30 is(lastSecurityState.extendedValidation, false);
31 iframe.src = "http://example.com/" + filepath;
32 break;
33 case 2:
34 is(lastSecurityState.state, 'insecure');
35 is(lastSecurityState.extendedValidation, false);
36 iframe.src = 'https://example.com:443/' + filepath + '?broken';
37 break;
38 case 3:
39 is(lastSecurityState.state, 'broken');
40 is(lastSecurityState.extendedValidation, false);
41 SimpleTest.finish();
42 }
43 });
45 iframe.src = "https://example.com/" + filepath;
46 document.body.appendChild(iframe);
47 }
49 addEventListener('testready', runTest);