| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script src="resources/log-pause-location.js"></script> |
| <script> |
| |
| let internalObject = { test: function() {} }; |
| |
| if (window.internals) { |
| internalObject = window.internals.evaluateInWorldIgnoringException("testPauseForInternalScripts", ` |
| //# sourceURL=__InjectedScript_TestPauseForInternalScripts.js |
| let InternalObject = class InternalObject { |
| test(invocationNumber) { |
| let a = 6; |
| let b = 7; |
| let answer = a * b; |
| } |
| }; |
| |
| new InternalObject; |
| `); |
| } |
| |
| function entryInternalObject() { |
| debugger; |
| internalObject.test(1); |
| internalObject.test(2); |
| internalObject.test(3); |
| } |
| |
| // --------- |
| |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("Debugger.setPauseForInternalScripts"); |
| |
| window.initializeSteppingTestSuite(suite); |
| |
| addSteppingTestCase({ |
| name: "Debugger.setPauseForInternalScripts.Disabled", |
| description: "Should not be able to step into statements which use internal injected scripts.", |
| expression: "setTimeout(entryInternalObject)", |
| // Call out directly to the backend since there is no other way to wait on the command result if changing via the setting. |
| setup: async () => { return DebuggerAgent.setPauseForInternalScripts(false); }, |
| steps: [ |
| "over", |
| "in", // internalObject.test(1) |
| "in", // internalObject.test(2) |
| "in", // internalObject.test(3) |
| "resume", |
| ] |
| }); |
| |
| addSteppingTestCase({ |
| name: "Debugger.setPauseForInternalScripts.Enabled", |
| description: "Should be able to step into statements which use internal injected scripts.", |
| expression: "setTimeout(entryInternalObject)", |
| // Call out directly to the backend since there is no other way to wait on the command result if changing via the setting. |
| setup: async () => { return DebuggerAgent.setPauseForInternalScripts(true); }, |
| teardown: async () => { return DebuggerAgent.setPauseForInternalScripts(false); }, |
| steps: [ |
| "over", |
| "in", // internalObject.test(1) |
| "in", // [Somewhere inside internalObject.test(1)] |
| "in", // [Somewhere inside internalObject.test(1)] |
| "resume", |
| ] |
| }); |
| |
| loadMainPageContent().then(() => { |
| suite.runTestCasesAndFinish(); |
| }); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Checking whether injected (internal) scripts can be stepped into or not, depending on the value of WI.settings.pauseForInternalScripts.</p> |
| </body> |
| </html> |