| Index: third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
|
| index 76f5e8c4d9e78c12eaefc078766b78125c1e16ec..09681bc6b3af844f46168a319173cfcf31339bfd 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
|
| @@ -4,35 +4,37 @@
|
| <script src="/resources/testharnessreport.js"></script>
|
| <body>
|
| <script>
|
| - async_test(t => {
|
| - var i = document.createElement('img');
|
| - i.onload = t.assert_unreached;
|
| - i.onerror = t.step_func_done(_ => {
|
| - assert_equals(0, i.naturalWidth);
|
| - assert_equals(0, i.naturalHeight);
|
| - });
|
| - i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=1";
|
| - }, "Mixed images are blocked in the presence of 'block-all-mixed-content'.");
|
| + function waitForEvent(t, el, name) {
|
| + return new EventWatcher(t, el, [name]).wait_for(name);
|
| + }
|
|
|
| async_test(t => {
|
| var i = document.createElement('img');
|
| - i.onload = t.assert_unreached;
|
| - document.addEventListener('securitypolicyviolation', t.step_func_done(e => {
|
| - var expectations = {
|
| - 'documentURI': document.location.toString(),
|
| - 'referrer': document.referrer,
|
| - 'blockedURI': 'http://127.0.0.1:8080',
|
| - 'violatedDirective': 'block-all-mixed-content',
|
| - 'effectiveDirective': 'block-all-mixed-content',
|
| - 'originalPolicy': 'block-all-mixed-content',
|
| - 'sourceFile': '',
|
| - 'lineNumber': 0,
|
| - 'columnNumber': 0,
|
| - 'statusCode': 0
|
| - };
|
| - for (key in expectations)
|
| - assert_equals(expectations[key], e[key], key);
|
| - }));
|
| - i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=2";
|
| - }, "Mixed images generate CSP violation reports in the presence of 'block-all-mixed-content'.");
|
| + i.onload = t.unreached_func();
|
| +
|
| + Promise.all([
|
| + waitForEvent(t, i, 'error').then(_ => {
|
| + assert_equals(0, i.naturalWidth);
|
| + assert_equals(0, i.naturalHeight);
|
| + }),
|
| + waitForEvent(t, document, 'securitypolicyviolation').then(e => {
|
| + var expectations = {
|
| + 'documentURI': document.location.toString(),
|
| + 'referrer': document.referrer,
|
| + 'blockedURI': 'http://127.0.0.1:8080/security/resources/compass.jpg?t=1',
|
| + 'violatedDirective': 'block-all-mixed-content',
|
| + 'effectiveDirective': 'block-all-mixed-content',
|
| + 'originalPolicy': 'block-all-mixed-content',
|
| + 'sourceFile': '',
|
| + 'lineNumber': 0,
|
| + 'columnNumber': 0,
|
| + 'statusCode': 0
|
| + };
|
| + for (key in expectations)
|
| + assert_equals(expectations[key], e[key], key);
|
| + })
|
| + ]).then(t.step_func_done());
|
| +
|
| + i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=1";
|
| + }, "Mixed images are blocked and generate CSP violation reports in the presence of 'block-all-mixed-content'.");
|
| </script>
|
|
|