CORS opera: Some bug fixes
authorOdin Hørthe Omdal <odinho@opera.com>
Mon, 15 Oct 2012 15:34:03 +0200
changeset 75 f07c7cb8d34c
parent 74 4b8bab60fd92
child 76 4d660aa42232
CORS opera: Some bug fixes
tests/cors/submitted/opera/js/https.htm
tests/cors/submitted/opera/js/preflight-cache.htm
tests/cors/submitted/opera/js/redirect.htm
tests/cors/submitted/opera/js/support.js
--- a/tests/cors/submitted/opera/js/https.htm	Mon Sep 24 13:54:43 2012 -0700
+++ b/tests/cors/submitted/opera/js/https.htm	Mon Oct 15 15:34:03 2012 +0200
@@ -11,9 +11,8 @@
     <div id="log"></div>
     <script>
 
-    var crossdomain = "crosssite." + location.hostname
+    var crossdomain = SUBDOMAIN + "." + location.hostname
     var url = "https://" + crossdomain + dirname(location.pathname)
-    var ports = PORTS
 
     /*
      * HTTPS
@@ -55,12 +54,12 @@
 
     testit('http://' + location.hostname + ":" + PORT + dirname(location.pathname) + 'resources/cors-headers.php',
         'http same domain different port')
-    testit('https://' + location.hostname + ":" + ports + dirname(location.pathname) + 'resources/cors-headers.php',
+    testit('https://' + location.hostname + ":" + PORTS + dirname(location.pathname) + 'resources/cors-headers.php',
         'https same domain different port')
 
     testit('http://' + crossdomain + ":" + PORT + dirname(location.pathname) + 'resources/cors-headers.php',
         'http crossdomain different port')
-    testit('https://' + crossdomain + ":" + ports + dirname(location.pathname) + 'resources/cors-headers.php',
+    testit('https://' + crossdomain + ":" + PORTS + dirname(location.pathname) + 'resources/cors-headers.php',
         'https crossdomain different port')
 
 
--- a/tests/cors/submitted/opera/js/preflight-cache.htm	Mon Sep 24 13:54:43 2012 -0700
+++ b/tests/cors/submitted/opera/js/preflight-cache.htm	Mon Oct 15 15:34:03 2012 +0200
@@ -82,10 +82,10 @@
         test_c++;
         var test = async_test("preflight first request, second from cache, wait, third should preflight again", { timeout: 6000 }),
             time = new Date().getTime(),
-            dothing = function (url, msg, setrequest, func) {
+            dothing = function (url, msg, set_request, func) {
                 client = new XMLHttpRequest(),
-                client.open('GET', url + test_c + time, true)
-                if (setrequest.length > 1)
+                client.open('GET', url + test_c + "_" + time, true)
+                if (set_request)
                     client.setRequestHeader('x-print', msg)
                 client.onreadystatechange = test.step_func(function() {
                     if(client.readyState >= 4) {
@@ -107,7 +107,7 @@
                 test = test;
 
                 /* Check if we did a preflight like we expected */
-                dothing('resources/checkandremovefromlog.php?ident=',
+                dothing('resources/checkandremovefromlog.php?1&ident=',
                 '1', false, function(){
                     test = test;
                     dothing(CROSSDOMAIN + 'resources/preflight.php?max_age=1&ident=',
@@ -115,7 +115,7 @@
                         test = test;
 
                         /* Check that we didn't do a preflight (hasn't gone 1 second yet) */
-                        dothing('resources/checkandremovefromlog.php?ident=',
+                        dothing('resources/checkandremovefromlog.php?2&ident=',
                         '0', false, function(){
                             test = test;
 
@@ -126,7 +126,7 @@
                                     test = test;
 
                                     /* Expect that we did indeed do a preflight */
-                                    dothing('resources/checkandremovefromlog.php?cache_bust&ident=',
+                                    dothing('resources/checkandremovefromlog.php?3&ident=',
                                     '1', false, function(){
                                         test.done()
                                     })
--- a/tests/cors/submitted/opera/js/redirect.htm	Mon Sep 24 13:54:43 2012 -0700
+++ b/tests/cors/submitted/opera/js/redirect.htm	Mon Oct 15 15:34:03 2012 +0200
@@ -30,7 +30,7 @@
             client.send(null)
 
             r = JSON.parse(client.response)
-            assert_equals(r['origin'], location.protocol + "//" + location.host, "Origin Header")
+            assert_equals(r['origin'], 'null', 'Origin Header')
             assert_equals(r['get_value'], 'last', 'get_value')
         },
         'Redirect ' + code)
--- a/tests/cors/submitted/opera/js/support.js	Mon Sep 24 13:54:43 2012 -0700
+++ b/tests/cors/submitted/opera/js/support.js	Mon Oct 15 15:34:03 2012 +0200
@@ -18,8 +18,6 @@
 /* This subdomain should point to this same location */
 var SUBDOMAIN = 'www1'
 var SUBDOMAIN2 = 'www2'
-//var PORT = "8081"
-//var PORTS = "8443"
 var PORT = "81"
 var PORTS = "83"