| Index: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-src-test.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-src-test.js b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-src-test.js
|
| index 83b58852ae8a8f389c0eee611c4cb76113f797d7..4168dcdf682edd4cad86eda7609fd016749fc607 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-src-test.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-src-test.js
|
| @@ -1,6 +1,9 @@
|
| var EXPECT_BLOCK = true;
|
| var EXPECT_LOAD = false;
|
|
|
| +var SAME_ORIGIN = true;
|
| +var CROSS_ORIGIN = false;
|
| +
|
| window.jsTestIsAsync = true;
|
| window.wasPostTestScriptParsed = true;
|
|
|
| @@ -63,3 +66,27 @@ function injectSharedWorker(url, expectBlock) {
|
| finishJSTest();
|
| };
|
| }
|
| +
|
| +function injectFrameWithCSP(url, csp, shouldBlock, sameOrigin) {
|
| + window.onload = function () {
|
| + iframe = document.createElement('iframe');
|
| + if (shouldBlock == EXPECT_LOAD && sameOrigin == CROSS_ORIGIN) {
|
| + window.addEventListener("message", function (e) {
|
| + if (e.source != iframe.contentWindow) {
|
| + return;
|
| + }
|
| + if (e.data != 'loaded')
|
| + testFailed("The inner IFrame failed.");
|
| + else
|
| + testPassed("The inner IFrame passed.");
|
| +
|
| + finishJSTest();
|
| + });
|
| + } else {
|
| + iframe.onload = iframeLoaded(shouldBlock);
|
| + }
|
| + iframe.src = url;
|
| + iframe.csp = csp;
|
| + document.body.appendChild(iframe);
|
| + };
|
| +}
|
|
|