Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js

Issue 1318153009: CSP: Loosen restrictions on inline style and event attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js
diff --git a/LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js b/LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js
index 25727b6a2365be39ff6eef801c7d47da0d5c802e..954e817e40c152eaa0b32e18362740ebf3267ed8 100644
--- a/LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js
+++ b/LayoutTests/http/tests/security/isolatedWorld/resources/bypass-main-world-csp-for-inline-script.js
@@ -21,24 +21,34 @@ function test() {
document.body.appendChild(script);
window.postMessage("next", "*");
}
+ function injectInlineEventHandler(isolated) {
+ var div = document.createElement('div');
+ div.innerHTML = "<div onclick='function () {}'></div>";
+ document.body.appendChild(div);
+ window.postMessage("next", "*");
+ }
switch (tests) {
case 4:
console.log("Injecting in main world: this should fail.");
injectInlineScript(false);
+ injectInlineEventHandler(false);
break;
case 3:
console.log("Injecting into isolated world without bypass: this should fail.");
testRunner.evaluateScriptInIsolatedWorld(1, String(eval("injectInlineScript")) + "\ninjectInlineScript(true);");
+ testRunner.evaluateScriptInIsolatedWorld(1, String(eval("injectInlineEventHandler")) + "\injectInlineEventHandler(true);");
break;
case 2:
console.log("Starting to bypass main world's CSP: this should pass!");
testRunner.setIsolatedWorldContentSecurityPolicy(1, 'script-src \'unsafe-inline\' *');
testRunner.evaluateScriptInIsolatedWorld(1, String(eval("injectInlineScript")) + "\ninjectInlineScript(true);");
+ testRunner.evaluateScriptInIsolatedWorld(1, String(eval("injectInlineEventHandler")) + "\injectInlineEventHandler(true);");
break;
case 1:
console.log("Injecting into main world again: this should fail.");
injectInlineScript(false);
+ injectInlineEventHandler(false);
break;
case 0:
testRunner.setIsolatedWorldContentSecurityPolicy(1, '');

Powered by Google App Engine
This is Rietveld 408576698