1 importScripts("worker-pre.js");
3 onmessage = function(evt
)
5 if (evt
.data
== "START")
11 postMessage("log " + message
);
24 function onSyncReqError()
35 req
= new XMLHttpRequest();
36 req
.onreadystatechange
= processStateChange
;
37 req
.onerror
= onSyncReqError
;
38 req
.onabort
= onReqAbort
;
39 req
.open("GET", "methods.cgi", true);
43 function processStateChange()
45 if (req
.readyState
== 4){
46 if (req
.status
== 200){
49 log('GET(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
50 req
.open("GET", "methods.cgi", true);
52 } else if (asyncStep
== 2) {
54 log('GET(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
55 req
.open("GET", "methods.cgi", true);
57 } else if (asyncStep
== 3) {
59 log('GET("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
60 req
.open("POST", "methods.cgi", true);
62 } else if (asyncStep
== 4) {
64 log('POST(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
65 req
.open("POST", "methods.cgi", true);
67 } else if (asyncStep
== 5) {
69 log('POST(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
70 req
.open("POST", "methods.cgi", true);
72 } else if (asyncStep
== 6) {
74 log('POST("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
75 req
.open("PUT", "methods.cgi", true);
77 } else if (asyncStep
== 7) {
79 log('PUT(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
80 req
.open("PUT", "methods.cgi", true);
82 } else if (asyncStep
== 8) {
84 log('PUT(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
85 req
.open("PUT", "methods.cgi", true);
87 } else if (asyncStep
== 9) {
89 log('PUT("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
90 req
.open("DELETE", "methods.cgi", true);
92 } else if (asyncStep
== 10) {
94 log('DELETE(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
95 req
.open("DELETE", "methods.cgi", true);
97 } else if (asyncStep
== 11) {
99 log('DELETE(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
100 req
.open("DELETE", "methods.cgi", true);
102 } else if (asyncStep
== 12) {
104 log('DELETE("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
105 req
.open("HEAD", "methods.cgi", true);
107 } else if (asyncStep
== 13) {
109 log('HEAD(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
110 req
.open("HEAD", "methods.cgi", true);
112 } else if (asyncStep
== 14) {
114 log('HEAD(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
115 req
.open("HEAD", "methods.cgi", true);
117 } else if (asyncStep
== 15) {
119 log('HEAD("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
120 req
.open("WKFOOBAR", "methods.cgi", true);
122 } else if (asyncStep
== 16) {
124 log('WKFOOBAR(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
125 req
.open("WKFOOBAR", "methods.cgi", true);
127 } else if (asyncStep
== 17) {
129 log('WKFOOBAR(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
130 req
.open("WKFOOBAR", "methods.cgi", true);
132 } else if (asyncStep
== 18) {
134 log('WKFOOBAR("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
135 req
.open("SEARCH", "methods.cgi", true);
137 } else if (asyncStep
== 19) {
139 log('SEARCH(""): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
140 req
.open("SEARCH", "methods.cgi", true);
142 } else if (asyncStep
== 20) {
144 log('SEARCH(null): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
145 req
.open("SEARCH", "methods.cgi", true);
147 } else if (asyncStep
== 21) {
148 log('SEARCH("123"): ' + req
.getResponseHeader("REQMETHOD") + "(" + req
.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req
.getResponseHeader("REQTYPE"));
152 log("Error loading URL: status " + req
.status
);