summaryrefslogtreecommitdiffstats
path: root/testing/marionette/harness/marionette_harness/www/modal_dialogs.html
blob: 8da5b92a76f42583b06b869990515ffc978cb0a3 (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
<!-- 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/. -->

<!DOCTYPE html>
<html>
<head>
  <title>Marionette Test</title>
  <script type="text/javascript">
    function handleAlert () {
      window.alert('Marionette alert');
    }

    function handleConfirm () {
      var alertAccepted = window.confirm('Marionette confirm');
      document.getElementById('confirm-result').innerHTML = alertAccepted;
    }

    function handlePrompt () {
      var promptText = window.prompt('Marionette prompt');
      document.getElementById('prompt-result').innerHTML = promptText === null ? 'null' : promptText;
    }

    function onBeforeUnload () {
      window.onbeforeunload = function () { return "Are you sure?"; }
    }
  </script>
</head>
<body>
   <a href="#" id="modal-alert" onclick="handleAlert()">Open an alert dialog.</a>
   <a href="#" id="modal-confirm" onclick="handleConfirm()">Open a confirm dialog.</a>
   <a href="#" id="modal-prompt" onclick="handlePrompt()">Open a prompt dialog.</a>
   <a href="#" id="onbeforeunload-handler" onclick="onBeforeUnload()">Add an onbeforeunload handler.</a>
   <a href="#" id="click-handler" onclick="document.getElementById('click-result').innerHTML='result';">Make text appear.</a>
   <div id="confirm-result"></div>
   <div id="prompt-result"></div>
   <div id="click-result"></div>
</body>
</html>