| Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
|
| index 99211815ad754408125eac3d04c83f63bcd9a9dc..d558429b2d6301df5e710de4525f837dfd916bfd 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
|
| @@ -4,6 +4,7 @@ header("Suborigin: foobar");
|
| <!DOCTYPE html>
|
| <html>
|
| <head>
|
| +<meta charset="utf-8">
|
| <title>Verify CORS behavior on Suborigin using EventSource</title>
|
| <script src="/resources/testharness.js"></script>
|
| <script src="/resources/testharnessreport.js"></script>
|
| @@ -12,69 +13,79 @@ header("Suborigin: foobar");
|
| <body>
|
| <div id="container"></div>
|
| <script>
|
| -var xorigin_anon_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
|
| -var xorigin_creds_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-credentials.php?';
|
| -var xorigin_ineligible_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
|
| +var xorigin_anon_event_source_string =
|
| + 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
|
| +var xorigin_creds_event_source_string =
|
| + 'http://127.0.0.1:8000/eventsource/resources/es-cors-credentials.php?';
|
| +var xorigin_ineligible_event_source_string =
|
| + 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
|
|
|
| -function xoriginAnonEventSource(acao_value) { return genCorsSrc(xorigin_anon_event_source_string, acao_value); }
|
| -function xoriginCredsEventSource(acao_value) { return genCorsSrc(xorigin_creds_event_source_string, acao_value); }
|
| -function xoriginIneligibleEventSource(acao_value) { return genCorsSrc(xorigin_ineligible_event_source_string); }
|
| +function xorigin_anon_event_source(acao_value) {
|
| + return gen_cors_src(xorigin_anon_event_source_string, acao_value);
|
| +}
|
| +function xorigin_creds_event_source(acao_value) {
|
| + return gen_cors_src(xorigin_creds_event_source_string, acao_value);
|
| +}
|
| +function xorigin_ineligible_event_source(acao_value) {
|
| + return gen_cors_src(xorigin_ineligible_event_source_string);
|
| +}
|
|
|
| // EventSource tests
|
| -var SuboriginEventSourceTest = function(pass, name, src, crossoriginValue) {
|
| - SuboriginTest.call(this, pass, "EventSource: " + name, src, crossoriginValue);
|
| +var SuboriginEventSourceTest = function(pass, name, src, crossorigin_value) {
|
| + SuboriginTest.call(
|
| + this, pass, 'EventSource: ' + name, src, crossorigin_value);
|
| }
|
|
|
| SuboriginEventSourceTest.prototype.execute = function() {
|
| - var test = async_test(this.name);
|
| - var pass = this.pass;
|
| - var options = {};
|
| + var test = async_test(this.name);
|
| + var pass = this.pass;
|
| + var options = {};
|
|
|
| - if (this.crossoriginValue === 'use-credentials') {
|
| - options.withCredentials = 'include';
|
| - }
|
| + if (this.crossorigin_value === 'use-credentials') {
|
| + options.withCredentials = 'include';
|
| + }
|
|
|
| - var es = new EventSource(this.src, options);
|
| - es.onmessage = test.step_func(function() {
|
| - if (pass) {
|
| - test.done();
|
| - } else {
|
| - assert_unreached("Bad EventSource received message.");
|
| - }
|
| + var es = new EventSource(this.src, options);
|
| + es.onmessage = test.step_func(function() {
|
| + if (pass) {
|
| + test.done();
|
| + } else {
|
| + assert_unreached('Bad EventSource received message.');
|
| + }
|
| });
|
| - es.onerror = test.step_func(function() {
|
| - if (pass) {
|
| - assert_unreached("Good EventSource failed to connect.");
|
| - } else {
|
| - test.done();
|
| - }
|
| + es.onerror = test.step_func(function() {
|
| + if (pass) {
|
| + assert_unreached('Good EventSource failed to connect.');
|
| + } else {
|
| + test.done();
|
| + }
|
| });
|
| };
|
|
|
| // EventSource tests
|
| new SuboriginEventSourceTest(
|
| - false,
|
| - "anonymous, ACAO: " + server,
|
| - xoriginAnonEventSource(),
|
| - "anonymous").execute();
|
| + false,
|
| + 'anonymous, ACAO: ' + server,
|
| + xorigin_anon_event_source(),
|
| + 'anonymous').execute();
|
|
|
| new SuboriginEventSourceTest(
|
| - true,
|
| - "anonymous, ACAO: *",
|
| - xoriginAnonEventSource('*'),
|
| - "anonymous").execute();
|
| + true,
|
| + 'anonymous, ACAO: *',
|
| + xorigin_anon_event_source('*'),
|
| + 'anonymous').execute();
|
|
|
| new SuboriginEventSourceTest(
|
| - false,
|
| - "use-credentials, ACAO: " + server,
|
| - xoriginCredsEventSource(),
|
| - "use-credentials").execute();
|
| + false,
|
| + 'use-credentials, ACAO: ' + server,
|
| + xorigin_creds_event_source(),
|
| + 'use-credentials').execute();
|
|
|
| new SuboriginEventSourceTest(
|
| - false,
|
| - "anonymous, CORS-ineligible resource",
|
| - xoriginIneligibleEventSource(),
|
| - "anonymous").execute();
|
| + false,
|
| + 'anonymous, CORS-ineligible resource',
|
| + xorigin_ineligible_event_source(),
|
| + 'anonymous').execute();
|
| </script>
|
| </body>
|
| </html>
|
|
|