Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr.php |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr.php b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr.php |
index 97aee1118dd9f71d6b479db4438aad0dd68c3883..7b8e2fad1bb5954bfba40fb6abeae7ec82ca127d 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr.php |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr.php |
@@ -4,6 +4,7 @@ header("Suborigin: foobar"); |
<!DOCTYPE html> |
<html> |
<head> |
+<meta charset="utf-8"> |
<title>Allow suborigin in HTTP header</title> |
<script src="/resources/testharness.js"></script> |
<script src="/resources/testharnessreport.js"></script> |
@@ -13,62 +14,55 @@ header("Suborigin: foobar"); |
<div id="container"></div> |
<script> |
// XMLHttpRequest tests |
-var SuboriginXHRTest = function(pass, name, src, crossoriginValue) { |
- SuboriginTest.call(this, pass, "XHR: " + name, src, crossoriginValue); |
+var SuboriginXHRTest = function(pass, name, src, crossorigin_value) { |
+ SuboriginTest.call(this, pass, 'XHR: ' + name, src, crossorigin_value); |
} |
SuboriginXHRTest.prototype.execute = function() { |
- var test = async_test(this.name); |
- var xhr = new XMLHttpRequest(); |
- |
- if (this.crossoriginValue === 'use-credentials') { |
+ var settings = this; |
+ async_test(test => { |
+ var xhr = new XMLHttpRequest(); |
+ if (settings.crossorigin_value === 'use-credentials') { |
xhr.withCredentials = true; |
- } |
+ } |
- if (this.pass) { |
- xhr.onload = function() { |
- test.done(); |
- }; |
- xhr.onerror = function() { |
- test.step(function() { assert_unreached("Good XHR fired error handler."); }); |
- }; |
- } else { |
- xhr.onload = function() { |
- test.step(function() { assert_unreached("Bad XHR successful."); }); |
- }; |
- xhr.onerror = function() { |
- test.done(); |
- }; |
- } |
+ if (settings.pass) { |
+ xhr.onload = test.step_func_done(); |
+ xhr.onerror = test.unreached_func('Good XHR fired error handler.'); |
+ } else { |
+ xhr.onload = test.unreached_func('Bad XHR successful.'); |
+ xhr.onerror = test.step_func_done(); |
+ } |
- xhr.open("GET", this.src); |
- xhr.send(); |
+ xhr.open('GET', settings.src); |
+ xhr.send(); |
+ }, settings.name); |
}; |
// XHR tests |
new SuboriginXHRTest( |
- false, |
- "<crossorigin='anonymous'>, ACAO: " + server, |
- xoriginAnonScript(), |
- "anonymous").execute(); |
+ false, |
+ '<crossorigin=\'anonymous\'>, ACAO: ' + server, |
+ xoriginAnonScript(), |
+ 'anonymous').execute(); |
new SuboriginXHRTest( |
- true, |
- "<crossorigin='anonymous'>, ACAO: *", |
- xoriginAnonScript('*'), |
- "anonymous").execute(); |
+ true, |
+ '<crossorigin=\'anonymous\'>, ACAO: *', |
+ xoriginAnonScript('*'), |
+ 'anonymous').execute(); |
new SuboriginXHRTest( |
- false, |
- "<crossorigin='use-credentials'>, ACAO: " + server, |
- xoriginCredsScript(), |
- "use-credentials").execute(); |
+ false, |
+ '<crossorigin=\'use-credentials\'>, ACAO: ' + server, |
+ xoriginCredsScript(), |
+ 'use-credentials').execute(); |
new SuboriginXHRTest( |
- false, |
- "<crossorigin='anonymous'>, CORS-ineligible resource", |
- xoriginIneligibleScript(), |
- "anonymous").execute(); |
+ false, |
+ '<crossorigin=\'anonymous\'>, CORS-ineligible resource', |
+ xoriginIneligibleScript(), |
+ 'anonymous').execute(); |
</script> |
</body> |
</html> |