crossorigin element resource loading should check HTTP redirection
[WebKit-https.git] / LayoutTests / swipe / pushState-programmatic-back-while-swiping-crash.html
1 <head>
2 <style>
3 html {
4     font-size: 32pt;
5 }
6 </style>
7 <script src="resources/swipe-test.js"></script>
8 <script>
9 function startSwipeGesture()
10 {
11     eventSender.mouseMoveTo(100, 100);
12
13     eventQueue.enqueueSwipeEvent(0, 0, 'maybegin');
14     eventQueue.enqueueScrollEvent(1, 0, 'began');
15     
16     eventQueue.callAfterEventDispatch(goBack);
17 }
18
19 function goBack()
20 {
21     window.history.back();
22
23     eventQueue.callAfterEventDispatch(continueSwipeGesture);
24 }
25
26 function continueSwipeGesture()
27 {
28     eventQueue.enqueueScrollEvent(1, 0, 'changed');
29
30     eventQueue.callAfterEventDispatch(completeSwipeGesture);
31 }
32
33 function completeSwipeGesture()
34 {
35     eventQueue.enqueueSwipeEvent(1, 0, 'changed');
36     eventQueue.enqueueSwipeEvent(256, 0, 'changed');
37     eventQueue.enqueueSwipeEvent(0, 0, 'ended');
38
39     eventQueue.callAfterEventDispatch(testComplete);
40 }
41
42 function didBeginSwipeCallback()
43 {
44     log("Failed. Should not begin swipe; we've already navigated away from the item where the swipe started, and there is no other back item.");
45 }
46
47 function isFirstPage()
48 {
49     return window.location.href.indexOf("second") == -1;
50 }
51
52 function updateContent()
53 {
54     document.body.innerHTML = isFirstPage() ? "first" : "second";
55 }
56
57 window.onload = function () {
58     if (!window.eventSender || !window.testRunner) {
59         document.body.innerHTML = "This test must be run in WebKitTestRunner.";
60         return;
61     }
62
63     updateContent();
64
65     initializeSwipeTest();
66
67     testRunner.installDidBeginSwipeCallback(didBeginSwipeCallback);
68
69     testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
70     testRunner.dumpAsText();
71     testRunner.waitUntilDone();
72
73     window.addEventListener("popstate", function(e) {
74         updateContent();
75     });
76
77     setTimeout(function () { 
78         history.pushState(null, null, "/second");
79         updateContent();
80
81         setTimeout(function () {
82             startSwipeGesture();
83         }, 0);
84     }, 0);
85 };
86 </script>
87 </head>
88 <body>
89 </body>