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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js

Issue 2112593003: [DevTools] Remove [V8] from InspectorInstrumentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: migrated to inspector-protocol test Created 4 years, 5 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: third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js
new file mode 100644
index 0000000000000000000000000000000000000000..31a5ce5c72109d80831cd62d583dc7b9bdf873df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js
@@ -0,0 +1,50 @@
+function test()
+{
+ InspectorTest.sendCommand("Debugger.enable", {});
+ InspectorTest.sendCommand("DOM.enable", {});
+ InspectorTest.sendCommand("DOMDebugger.enable", {});
+ InspectorTest.sendCommand("DOMDebugger.setInstrumentationBreakpoint", {"eventName":"scriptBlockedByCSP"});
+ InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused;
+
+ var expressions = [
+ "\n document.getElementById('testButton').click();",
+
+ "\n var script = document.createElement('script');" +
+ "\n script.innerText = 'alert(1)';" +
+ "\n document.body.appendChild(script);",
+
+ "\n var a = document.createElement('a');" +
+ "\n a.setAttribute('href', 'javascript:alert(1);');" +
+ "\n var dummy = 1; " +
+ "\n document.body.appendChild(a); a.click();"
+ ];
+ var descriptions = [
+ "blockedEventHandler",
+ "blockedScriptInjection",
+ "blockedScriptUrl"
+ ];
+
+ function nextExpression()
+ {
+ if (!expressions.length) {
+ InspectorTest.completeTest();
+ return;
+ }
+ var description = descriptions.shift();
+ InspectorTest.log("\n-------\n" + description);
+ InspectorTest.sendCommand("Runtime.evaluate", { "expression": "function " + description + "() {" + expressions.shift() + "}\n" + description + "()"});
+ }
+
+ function handleDebuggerPaused(messageObject)
+ {
+ var params = messageObject.params;
+ InspectorTest.log("Paused at: " + params.callFrames[0].functionName + "@" + params.callFrames[0].location.lineNumber);
+ InspectorTest.log("Reason: " + params.reason + "; Data:");
+ InspectorTest.logObject(params.data);
+ InspectorTest.sendCommand("Debugger.resume", { }, nextExpression);
+ }
+
+ nextExpression();
+}
+
+window.addEventListener("load", runTest.bind(null, false));

Powered by Google App Engine
This is Rietveld 408576698