summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/ssl/firefox.html
blob: ef7ed4eea6b72f8806616e50f7a205ce8143cf64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html>
<!-- This SSL interstitial is designed to look like the Firefox SSL error, with
     permission from Firefox to copy the appearance of the page for an A/B
     experiment. -->
<html i18n-values="dir:textdirection">
<head>
  <meta charset="utf-8">
  <title>Untrusted Connection</title>
  <style>
  body {
    background-color: #dddad5;
    color: #000000;
    margin: 0;
    padding: 0 1em;
  }
  #box {
    background-color: #ffffff;
    border: 1px solid #ffbd09;
    margin: 40px auto;
    max-width: 52em;
    min-width: 13em;
    padding: 50px 0px 30px 0px;
    position: relative;
    -webkit-border-radius: 10px;
  }
  .clickable {
    margin: 1em 0 0 60px;
  }
  h1 {
    border-bottom: 1px solid #dddad5;
    font-size: 160%;
    margin: 0 0 .6em 0;
  }
  h2 {
    font-size: 130%;
  }
  .icon {
    position: absolute;
  }
  #inner-box {
    margin: 0 40px 0 30px;
  }
  .main {
    margin: 1em 0 0 80px;
  }
  .open {
    display: none;
  }
  .subtext {
    padding-left: 20px;
  }
  .subtitle {
    cursor: pointer;
  }
  .title {
    margin: 0 0 0 80px;
  }
  .twisty {
    cursor: pointer;
    float:left;
    padding-right: 10px;
    padding-top: 8px;
  }
  </style>

  <script>
    // Should match SSLBlockingPageCommands in ssl_blocking_page.cc.
    var CMD_DONT_PROCEED = 0;
    var CMD_PROCEED = 1;
    var CMD_FOCUS = 2;
    var CMD_MORE = 3;
    var CMD_UNDERSTAND = 4;

    var showedMore = false;
    var showedUnderstand = false;
    var keyPressState = 0;
    var gainFocus = false;

    function $(o) {
      return document.getElementById(o);
    }

    function sendCommand(cmd) {
      window.domAutomationController.setAutomationId(1);
      window.domAutomationController.send(cmd);
    }

    function toggleMoreInfo() {
      var status = !$('more-info-content').hidden;
      $('more-info-content').hidden = status;
      if (status) {
        $('more-info-twisty-closed').style.display = 'inline';
        $('more-info-twisty-open').style.display = 'none';
      } else {
        $('more-info-twisty-open').style.display = 'inline';
        $('more-info-twisty-closed').style.display = 'none';
        if (!showedMore) {
          sendCommand(CMD_MORE);
          showedMore = true;
        }
      }
    }

    function toggleUnderstand() {
      var status = !$('understand-content').hidden;
      $('understand-content').hidden = status;
      if (status) {
        $('understand-twisty-closed').style.display = 'inline';
        $('understand-twisty-open').style.display = 'none';
      } else {
        $('understand-twisty-open').style.display = 'inline';
        $('understand-twisty-closed').style.display = 'none';
        if (!showedUnderstand) {
          sendCommand(CMD_UNDERSTAND);
          showedUnderstand = true;
        }
      }
    }

    // This allows errors to be skippped by typing "proceed" into the page.
    function keyPressHandler(e) {
      var sequence = 'proceed';
      if (sequence.charCodeAt(keyPressState) == e.keyCode) {
        keyPressState++;
        if (keyPressState == sequence.length) {
          sendCommand(CMD_PROCEED);
          keyPressState = 0;
        }
      } else {
        keyPressState = 0;
      }
    }

    // Supports UMA timing, which starts after the warning is first viewed.
    function handleFocusEvent() {
      if (gainFocus == false) {
        sendCommand(CMD_FOCUS);
        gainFocus = true;
      }
    }

    // UI modifications and event listeners that take place after load.
    function setupEvents() {
      if (templateData.errorType == 'overridable') {
        $('proceed').hidden = false;
        $('proceed-button').addEventListener('click', function() {
          sendCommand(CMD_PROCEED);
        });
      } else {
        document.addEventListener('keypress', keyPressHandler);
      }
      
      if (templateData.trialType == "Condition18SSLNoImages") {
        $('icon-img').style.display = 'none';
      }

      $('exit-button').addEventListener('click', function() {
        sendCommand(CMD_DONT_PROCEED);
      });

      $('more-info-title').addEventListener('click', function() {
        toggleMoreInfo();
      });

      $('more-info-twisty-open').addEventListener('click', function() {
        toggleMoreInfo();
      });

      $('more-info-twisty-closed').addEventListener('click', function() {
        toggleMoreInfo();
      });

      $('understand-title').addEventListener('click', function() {
        toggleUnderstand();
      });

      $('understand-twisty-open').addEventListener('click', function() {
        toggleUnderstand();
      });

      $('understand-twisty-closed').addEventListener('click', function() {
        toggleUnderstand();
      });

      document.addEventListener('contextmenu', function(e) {
        e.preventDefault();
      });
    }

    window.addEventListener('focus', handleFocusEvent);
    document.addEventListener('DOMContentLoaded', setupEvents);
  </script>
</head>
<body i18n-values=".style.fontFamily:fontfamily">
<div id="box">
  <div id="inner-box">
    <div class="icon">
      <img src="firefox_icon.png" alt="SSL Error Icon" id="icon-img">
    </div>

    <div class="title">
      <h1 class="titleText">This Connection is Untrusted</h1>
    </div>

    <div class="main">
      <p>
      You have asked Chrome to connect securely to <b><span
      i18n-values=".innerHTML:domain"></span></b>, but we can't confirm that
      your connection is secure.
      </p>
      <p>
      Normally, when you try to connect securely, sites will present
      trusted identification to prove that you are going to the right place.
      However, this site's identity can't be verified.
      </p>
    </div>

    <div class="main">
      <h2>What Should I Do?</h2>
      <p>If you usually connect to this site without problems, this error could
        mean that someone is trying to impersonate the site, and you shouldn't
        continue.</p>
        <button id="exit-button">Get me out of here!</button>
    </div>

    <div class="clickable">
      <img class="twisty" id="more-info-twisty-closed"
          src="firefox_twisty_closed.png" border="0">
      <img class="twisty open" id="more-info-twisty-open"
          src="firefox_twisty_open.png" border="0">
      <h2 id="more-info-title" class="subtitle">Technical Details</h2>
      <div id="more-info-content" class="subtext" hidden>
        <p i18n-values=".innerHTML:moreInfo1"></p>
        <p i18n-values=".innerHTML:moreInfo2"></p>
        <p i18n-values=".innerHTML:moreInfo3"></p>
        <p i18n-values=".innerHTML:moreInfo4"></p>
        <p i18n-values=".innerHTML:moreInfo5"></p>
      </div>
    </div>

    <div class="clickable" id="proceed" hidden>
      <img class="twisty" id="understand-twisty-closed"
          src="firefox_twisty_closed.png" border="0">
      <img class="twisty open" id="understand-twisty-open"
          src="firefox_twisty_open.png" border="0">
      <h2 id="understand-title" class="subtitle">I Understand the Risks</h2>
      <div id="understand-content" class="subtext" hidden>
        <p>If you understand what's going on, you can click the button below to
        proceed to the site. <b>Even if you trust the site, this error could
        mean that someone is tampering with your connection.</b></p>
        <p>Don't proceed to the site unless you know there's a good reason why
        this site doesn't use trusted identification.</p>
        <button id="proceed-button">Proceed Anyway</button>
      </div>
    </div>
  </div>
</div>

</body>
</html>