1<html>
2<head>
3<script>
4function log(message)
5{
6    document.getElementById("result").innerHTML += message + "<br>";
7}
8
9function loadJSFile(){
10    var s = document.createElement('script')
11    s.setAttribute("type", "text/javascript")
12    s.setAttribute("src", "resources/load-deferrer-script-element.js")
13
14    document.getElementsByTagName("head")[0].appendChild(s);
15}
16
17jsLoaded = false;
18runningModal = false;
19
20// This line will load external script into memory.
21loadJSFile();
22
23function runModal()
24{
25    jsLoaded = true;
26    loadJSFile();
27 
28    runningModal = true;
29    alert("Scripts should not be running in the background!");
30    runningModal = false;
31}
32</script>
33</head>
34 
35<body>
36    
37<p>This tests the bug https://bugs.webkit.org/show_bug.cgi?id=38910.
38Click the button, wait 5 seconds and close it.
39The test passes if no error messages show up in the page!</p>
40<input id="button" type="button" value="click me" onclick="runModal()"/>
41<p id="result"></p>
42
43</body>
44</html>
45