OLD | NEW |
(Empty) | |
| 1 function test() |
| 2 { |
| 3 InspectorTest.sendCommand("Debugger.enable", {}); |
| 4 InspectorTest.sendCommand("DOM.enable", {}); |
| 5 InspectorTest.sendCommand("DOMDebugger.enable", {}); |
| 6 InspectorTest.sendCommand("DOMDebugger.setInstrumentationBreakpoint", {"even
tName":"scriptBlockedByCSP"}); |
| 7 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused; |
| 8 |
| 9 var expressions = [ |
| 10 "\n document.getElementById('testButton').click();", |
| 11 |
| 12 "\n var script = document.createElement('script');" + |
| 13 "\n script.innerText = 'alert(1)';" + |
| 14 "\n document.body.appendChild(script);", |
| 15 |
| 16 "\n var a = document.createElement('a');" + |
| 17 "\n a.setAttribute('href', 'javascript:alert(1);');" + |
| 18 "\n var dummy = 1; " + |
| 19 "\n document.body.appendChild(a); a.click();" |
| 20 ]; |
| 21 var descriptions = [ |
| 22 "blockedEventHandler", |
| 23 "blockedScriptInjection", |
| 24 "blockedScriptUrl" |
| 25 ]; |
| 26 |
| 27 function nextExpression() |
| 28 { |
| 29 if (!expressions.length) { |
| 30 InspectorTest.completeTest(); |
| 31 return; |
| 32 } |
| 33 var description = descriptions.shift(); |
| 34 InspectorTest.log("\n-------\n" + description); |
| 35 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "function
" + description + "() {" + expressions.shift() + "}\n" + description + "()"}); |
| 36 } |
| 37 |
| 38 function handleDebuggerPaused(messageObject) |
| 39 { |
| 40 var params = messageObject.params; |
| 41 InspectorTest.log("Paused at: " + params.callFrames[0].functionName + "@
" + params.callFrames[0].location.lineNumber); |
| 42 InspectorTest.log("Reason: " + params.reason + "; Data:"); |
| 43 InspectorTest.logObject(params.data); |
| 44 InspectorTest.sendCommand("Debugger.resume", { }, nextExpression); |
| 45 } |
| 46 |
| 47 nextExpression(); |
| 48 } |
| 49 |
| 50 window.addEventListener("load", runTest.bind(null, false)); |
OLD | NEW |