Index: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-csp-test.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-csp-test.js b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-csp-test.js |
index 77f8228d9027d4364fa537468ec1592648fbc95c..87d131252e0a7ebadb360743bdfd066994059f4b 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-csp-test.js |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/child-csp-test.js |
@@ -21,7 +21,11 @@ function injectIframeWithCSP(url, shouldBlock, csp, t, urlId) { |
}); |
if (shouldBlock) { |
- window.onmessage = t.unreached_func('No message should be sent from the frame.'); |
+ window.onmessage = function (e) { |
+ if (e.source != i.contentWindow) |
+ return; |
+ t.unreached_func('No message should be sent from the frame.'); |
+ } |
i.onload = t.step_func(function () { |
// Delay the check until after the postMessage has a chance to execute. |
setTimeout(t.step_func_done(function () { |