[DevTools] Migrate inspector-protocol/debugger tests to new harness
BUG=734762
Review-Url: https://codereview.chromium.org/2968523003
Cr-Commit-Position: refs/heads/master@{#484356}
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
index 82f6d37..517751a2 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -16369,8 +16369,8 @@
crbug.com/591099 inspector-protocol/css/cssom-matching-rules.html [ Failure ]
crbug.com/591099 inspector-protocol/css/cssom-modify-rule-and-get-rule-list.html [ Failure ]
crbug.com/591099 inspector-protocol/css/media-query-listener-exception.html [ Failure ]
-crbug.com/591099 inspector-protocol/debugger/debugger-step-into-dedicated-worker.html [ Failure ]
-crbug.com/591099 inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.html [ Failure ]
+crbug.com/591099 inspector-protocol/debugger/debugger-step-into-dedicated-worker.js [ Failure ]
+crbug.com/591099 inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.js [ Failure ]
crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot.js [ Crash Failure Timeout ]
crbug.com/591099 inspector-protocol/emulation/device-emulation-small-dw.js [ Failure ]
crbug.com/591099 inspector-protocol/emulation/device-emulation-small.js [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests
index 89e2d00..d68e0905 100644
--- a/third_party/WebKit/LayoutTests/SlowTests
+++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -268,7 +268,7 @@
crbug.com/480769 virtual/mojo-loading/http/tests/inspector/service-workers/service-workers-redundant.html [ Slow ]
crbug.com/480769 http/tests/inspector/service-workers/service-worker-agents.html [ Slow ]
crbug.com/480769 virtual/mojo-loading/http/tests/inspector/service-workers/service-worker-agents.html [ Slow ]
-crbug.com/504703 inspector-protocol/debugger/debugger-step-into-dedicated-worker.html [ Slow ]
+crbug.com/504703 inspector-protocol/debugger/debugger-step-into-dedicated-worker.js [ Slow ]
crbug.com/535478 [ Win ] virtual/threaded/inspector/tracing/decode-resize.html [ Slow ]
crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Slow ]
crbug.com/548765 virtual/mojo-loading/http/tests/inspector/console-fetch-logging.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame-expected.txt
index 856e153..87741ca 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame-expected.txt
@@ -1,3 +1,4 @@
+
Paused on 'debugger;'
resume
restartFrame
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html
deleted file mode 100644
index 7d1ba5d..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function testFunction()
-{
- debugger;
-}
-
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {});
-
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne;
-
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(testFunction, 0)" });
-
- var obsoleteTopFrameId;
-
- function handleDebuggerPausedOne(messageObject)
- {
- InspectorTest.log("Paused on 'debugger;'");
-
- var topFrame = messageObject.params.callFrames[0];
- obsoleteTopFrameId = topFrame.callFrameId;
-
- InspectorTest.eventHandler["Debugger.paused"] = undefined;
-
- InspectorTest.sendCommand("Debugger.resume", { }, callbackResume);
- }
-
- function callbackResume(response)
- {
- InspectorTest.log("resume");
- InspectorTest.log("restartFrame");
- InspectorTest.sendCommand("Debugger.restartFrame", { callFrameId: obsoleteTopFrameId }, callbackRestartFrame);
- }
-
- function callbackRestartFrame(response)
- {
- logErrorResponse(response);
- InspectorTest.log("evaluateOnFrame");
- InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: obsoleteTopFrameId, expression: "0"} , callbackEvaluate);
- }
-
- function callbackEvaluate(response)
- {
- logErrorResponse(response);
- InspectorTest.log("setVariableValue");
- InspectorTest.sendCommand("Debugger.setVariableValue", { callFrameId: obsoleteTopFrameId, scopeNumber: 0, variableName: "a", newValue: { value: 0 } }, callbackSetVariableValue);
- }
-
- function callbackSetVariableValue(response)
- {
- logErrorResponse(response);
- InspectorTest.completeTest();
- }
-
- function logErrorResponse(response)
- {
- if (response.error) {
- if (response.error.message.indexOf("Can only perform operation while paused.") != -1) {
- InspectorTest.log("PASS, error message as expected");
- return;
- }
- }
- InspectorTest.log("FAIL, unexpected error message");
- InspectorTest.log(JSON.stringify(response));
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.js
new file mode 100644
index 0000000..b9ec2d0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.js
@@ -0,0 +1,35 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function logErrorResponse(response) {
+ if (response.error) {
+ if (response.error.message.indexOf('Can only perform operation while paused.') != -1) {
+ testRunner.log('PASS, error message as expected');
+ return;
+ }
+ }
+ testRunner.log('FAIL, unexpected error message');
+ testRunner.log(JSON.stringify(response));
+ }
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: 'setTimeout(() => { debugger; }, 0)' });
+
+ var messageObject = await dp.Debugger.oncePaused();
+ testRunner.log(`Paused on 'debugger;'`);
+ var topFrame = messageObject.params.callFrames[0];
+ var obsoleteTopFrameId = topFrame.callFrameId;
+
+ await dp.Debugger.resume();
+ testRunner.log('resume');
+ testRunner.log('restartFrame');
+
+ logErrorResponse(await dp.Debugger.restartFrame({callFrameId: obsoleteTopFrameId}));
+ testRunner.log('evaluateOnFrame');
+
+ logErrorResponse(await dp.Debugger.evaluateOnCallFrame({callFrameId: obsoleteTopFrameId, expression: '0'}));
+ testRunner.log('setVariableValue');
+
+ logErrorResponse(await dp.Debugger.setVariableValue({callFrameId: obsoleteTopFrameId, scopeNumber: 0, variableName: 'a', newValue: { value: 0 }}));
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation-expected.txt
index d309d42..ccc8515 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation-expected.txt
@@ -1,3 +1,4 @@
+
Paused on 'debugger;'
Top frame location: {"scriptId":"42","lineNumber":8,"columnNumber":4}
Top frame functionLocation: {"scriptId":"42","lineNumber":5,"columnNumber":21}
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.html
deleted file mode 100644
index 84fab01dd..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function testFunction()
-{
- var a = 2;
- debugger;
-}
-
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {});
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused;
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(testFunction, 0)" });
-
- function handleDebuggerPaused(messageObject)
- {
- InspectorTest.log("Paused on 'debugger;'");
- var topFrame = messageObject.params.callFrames[0];
- topFrame.location.scriptId = "42";
- topFrame.functionLocation.scriptId = "42";
- InspectorTest.log("Top frame location: " + JSON.stringify(topFrame.location));
- InspectorTest.log("Top frame functionLocation: " + JSON.stringify(topFrame.functionLocation));
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.js
new file mode 100644
index 0000000..f7f3db31
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/call-frame-functionLocation.js
@@ -0,0 +1,26 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: `
+
+
+
+
+function testFunction()
+{
+ var a = 2;
+ debugger;
+}
+setTimeout(testFunction, 0);
+ `});
+
+ var messageObject = await dp.Debugger.oncePaused();
+ testRunner.log(`Paused on 'debugger;'`);
+ var topFrame = messageObject.params.callFrames[0];
+ topFrame.location.scriptId = '42';
+ topFrame.functionLocation.scriptId = '42';
+ testRunner.log('Top frame location: ' + JSON.stringify(topFrame.location));
+ testRunner.log('Top frame functionLocation: ' + JSON.stringify(topFrame.functionLocation));
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation-expected.txt
index d0c6ce7..404cd9ac 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation-expected.txt
@@ -1,3 +1,4 @@
+
Paused on debugger statement
Paused after continueToLocation
Stopped on line 8, expected 8, requested 8, (0-based numbers).
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.html
deleted file mode 100644
index 5ae2992..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script type="text/javascript" src="resources/statements.js"></script>
-<script>
-
-function test()
-{
- var scenario = [
- // requested line number, expected control parameter 'step', expected line number
- [ 8, 1, 8 ],
- [ 8, 1, 8 ],
- [ 12, 6, 17 ],
- [ 13, 6, 17 ],
- [ 17, 6, 17 ],
- [ 17, 6, 17 ],
- ];
-
- InspectorTest.sendCommand("Debugger.enable", {});
-
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExample" }, callbackEvalFunctionObject);
-
- function callbackEvalFunctionObject(response)
- {
- var functionObjectId = response.result.result.objectId;
- InspectorTest.sendCommand("Runtime.getProperties", { objectId: functionObjectId }, callbackFunctionDetails);
- }
-
- function callbackFunctionDetails(response)
- {
- var result = response.result;
- var scriptId;
- for (var prop of result.internalProperties) {
- if (prop.name === "[[FunctionLocation]]")
- scriptId = prop.value.value.scriptId;
- }
-
- nextScenarioStep(0);
-
- function nextScenarioStep(pos)
- {
- if (pos < scenario.length)
- gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1], scenario[pos][2], nextScenarioStep.bind(this, pos + 1));
- else
- InspectorTest.completeTest();
- }
- }
-
- function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedLineNumber, next)
- {
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne;
-
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(statementsExample, 0)" });
-
- function handleDebuggerPausedOne(messageObject)
- {
- InspectorTest.log("Paused on debugger statement");
-
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedTwo;
-
- InspectorTest.sendCommand("Debugger.continueToLocation", { location: { scriptId: scriptId, lineNumber: lineNumber, columnNumber: 0} }, logContinueToLocation);
-
- function logContinueToLocation(response)
- {
- if (response.error) {
- InspectorTest.log("Failed to execute continueToLocation " + JSON.stringify(response.error));
- InspectorTest.completeTest();
- }
- }
- }
- function handleDebuggerPausedTwo(messageObject)
- {
- InspectorTest.log("Paused after continueToLocation");
- var actualLineNumber = messageObject.params.callFrames[0].location.lineNumber;
-
- InspectorTest.log("Stopped on line " + actualLineNumber + ", expected " + expectedLineNumber + ", requested " + lineNumber + ", (0-based numbers).");
-
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedUnexpected;
-
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "statementsExample.step" }, callbackStepEvaluate);
- }
-
- function callbackStepEvaluate(response)
- {
- var resultValue = response.result.result.value;
- InspectorTest.log("Control parameter 'step' calculation result: " + resultValue + ", expected: " + expectedResult);
- InspectorTest.log(resultValue == expectedResult ? "SUCCESS" : "FAIL");
- InspectorTest.sendCommand("Debugger.resume", { });
- next();
- }
-
- function handleDebuggerPausedUnexpected(messageObject)
- {
- InspectorTest.log("Unexpected debugger pause");
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js
new file mode 100644
index 0000000..466535a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js
@@ -0,0 +1,79 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function statementsExample()
+ {
+ var self = arguments.callee;
+
+ debugger;
+
+ self.step = 1;
+
+ self.step = 2;
+
+ void [
+ self.step = 3,
+ self.step = 4,
+ self.step = 5,
+ self.step = 6
+ ];
+
+ self.step = 7;
+ }
+
+ var scenarios = [
+ // requested line number, expected control parameter 'step', expected line number
+ [ 8, 1, 8 ],
+ [ 8, 1, 8 ],
+ [ 12, 6, 17 ],
+ [ 13, 6, 17 ],
+ [ 17, 6, 17 ],
+ [ 17, 6, 17 ],
+ ];
+
+ dp.Debugger.enable();
+ var functionResponse = await dp.Runtime.evaluate({expression: statementsExample.toString() + '; statementsExample'});
+ var functionObjectId = functionResponse.result.result.objectId;
+
+ var detailsResponse = await dp.Runtime.getProperties({objectId: functionObjectId});
+ var scriptId;
+ for (var prop of detailsResponse.result.internalProperties) {
+ if (prop.name === '[[FunctionLocation]]')
+ scriptId = prop.value.value.scriptId;
+ }
+
+ for (var scenario of scenarios) {
+ var lineNumber = scenario[0];
+ var expectedResult = scenario[1];
+ var expectedLineNumber = scenario[2];
+ dp.Runtime.evaluate({expression: 'setTimeout(statementsExample, 0)' });
+ await dp.Debugger.oncePaused();
+ testRunner.log('Paused on debugger statement');
+
+ var continueToLocationResponse = await dp.Debugger.continueToLocation({location: {scriptId, lineNumber, columnNumber: 0}});
+ if (continueToLocationResponse.error) {
+ testRunner.log('Failed to execute continueToLocation ' + JSON.stringify(continueToLocationResponse.error));
+ testRunner.completeTest();
+ return;
+ }
+
+ var messageObject = await dp.Debugger.oncePaused();
+ testRunner.log('Paused after continueToLocation');
+ var actualLineNumber = messageObject.params.callFrames[0].location.lineNumber;
+ testRunner.log('Stopped on line ' + actualLineNumber + ', expected ' + expectedLineNumber + ', requested ' + lineNumber + ', (0-based numbers).');
+
+ dp.Debugger.onPaused(handleDebuggerPausedUnexpected);
+ var resultValue = (await dp.Runtime.evaluate({expression: 'statementsExample.step' })).result.result.value;
+ testRunner.log(`Control parameter 'step' calculation result: ${resultValue}, expected: ${expectedResult}`);
+ testRunner.log(resultValue == expectedResult ? 'SUCCESS' : 'FAIL');
+ dp.Debugger.resume();
+ dp.Debugger.offPaused(handleDebuggerPausedUnexpected);
+
+ function handleDebuggerPausedUnexpected() {
+ testRunner.log('Unexpected debugger pause');
+ testRunner.completeTest();
+ }
+ }
+
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.html
deleted file mode 100644
index 5bacfae..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function foo()
-{
- return 239;
-}
-
-function test()
-{
- InspectorTest.sendCommandOrDie("Debugger.enable", {});
- InspectorTest.eventHandler["Debugger.paused"] = debuggerPaused;
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "(function boo() { setTimeout(foo, 0); debugger; })()" });
-
- var actions = [ "stepInto", "stepInto", "stepInto" ];
- function debuggerPaused(result)
- {
- InspectorTest.log("Stack trace:");
- for (var callFrame of result.params.callFrames)
- InspectorTest.log(callFrame.functionName + ':' + callFrame.location.lineNumber + ":" + callFrame.location.columnNumber);
- InspectorTest.log("");
-
- var action = actions.shift();
- if (!action) {
- InspectorTest.sendCommandOrDie("Debugger.resume", {}, () => InspectorTest.completeTest());
- return;
- }
- InspectorTest.log("Perform " + action);
- InspectorTest.sendCommandOrDie("Debugger." + action, {});
- }
-}
-</script>
-</head>
-<body >
-Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js.
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.js
new file mode 100644
index 0000000..64fd2d3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-doesnt-step-into-injected-script.js
@@ -0,0 +1,38 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js.');
+
+ function logStack(event) {
+ testRunner.log('Stack trace:');
+ for (var callFrame of event.params.callFrames)
+ testRunner.log(callFrame.functionName + ':' + callFrame.location.lineNumber + ':' + callFrame.location.columnNumber);
+ testRunner.log('');
+ }
+
+ dp.Debugger.enable();
+ await session.evaluate(`
+
+
+
+
+
+ function foo() {
+ return 239;
+ }`);
+ dp.Runtime.evaluate({expression: '(function boo() { setTimeout(foo, 0); debugger; })()' });
+
+ logStack(await dp.Debugger.oncePaused());
+ testRunner.log('Perform stepInto');
+ dp.Debugger.stepInto();
+
+ logStack(await dp.Debugger.oncePaused());
+ testRunner.log('Perform stepInto');
+ dp.Debugger.stepInto();
+
+ logStack(await dp.Debugger.oncePaused());
+ testRunner.log('Perform stepInto');
+ dp.Debugger.stepInto();
+
+ logStack(await dp.Debugger.oncePaused());
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page-expected.txt
index 81e00ce..aa6355b6 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page-expected.txt
@@ -1,3 +1,4 @@
+
Started worker
Paused on 'debugger;'
Worker created
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.html
deleted file mode 100644
index ddae332..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.html
+++ /dev/null
@@ -1,80 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-var worker;
-
-function testFunction()
-{
- debugger;
-}
-
-function startWorkerAndRunTest()
-{
- worker = new Worker("resources/dedicated-worker.js");
- worker. { };
- worker.postMessage(1);
- log("Started worker");
- runTest();
-}
-
-function test()
-{
- var workerId;
- var workerRequestId = 1;
-
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId })
- });
- return workerRequestId++;
- }
-
- InspectorTest.sendCommand("Debugger.enable", {});
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedInTestFunction;
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" });
-
- function handleDebuggerPausedInTestFunction(messageObject)
- {
- InspectorTest.log("Paused on 'debugger;'");
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: false}, didEnableWorkerDebugging);
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
-
- var savedWorkerRequestId = -1;
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- InspectorTest.log("didConnectToWorker");
- savedWorkerRequestId = sendCommandToWorker("Runtime.evaluate", { "expression": "1+1"});
- }
-
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["id"] === savedWorkerRequestId) {
- var value = message["result"]["result"]["value"];
- InspectorTest.log("Successfully evaluated, result: " + value);
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.js
new file mode 100644
index 0000000..76ede5e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.js
@@ -0,0 +1,39 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: 'debugger;' });
+ await dp.Debugger.oncePaused();
+ testRunner.log(`Paused on 'debugger;'`);
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: false});
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ var workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+ testRunner.log('didConnectToWorker');
+
+ var savedWorkerRequestId = sendCommandToWorker('Runtime.evaluate', {expression: '1+1'});
+ dp.Target.onReceivedMessageFromTarget(messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.id === savedWorkerRequestId) {
+ var value = message.result.result.value;
+ testRunner.log('Successfully evaluated, result: ' + value);
+ testRunner.completeTest();
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-expected.txt
index e412394..bd6d733 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-expected.txt
@@ -1,3 +1,4 @@
+
Started worker
Worker created
didConnectToWorker
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop-expected.txt
index ab9d5310a..0b8048b 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop-expected.txt
@@ -1,3 +1,4 @@
+
Started worker
Worker created
didConnectToWorker
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.html
deleted file mode 100644
index 5d3c19d..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-var worker;
-function startWorkerAndRunTest()
-{
- worker = new Worker("resources/dedicated-worker-loop.js");
- worker.>
- {
- if (event.data === "WorkerMessageReceived")
- evaluateInFrontend("InspectorTest.workerMessageReceived()");
- };
- log("Started worker");
- runTest();
-}
-
-function test()
-{
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId })
- });
- return workerRequestId++;
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: false}, didEnableWorkerDebugging);
-
- var evaluateRequestId = -1;
- var debuggerEnableRequestId = -1;
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- InspectorTest.log("didConnectToWorker");
- // Enable debugger so that V8 can interrupt and handle inspector commands while there is a script running in a tight loop.
- debuggerEnableRequestId = sendCommandToWorker("Debugger.enable", {});
- }
-
- InspectorTest.workerMessageReceived = function()
- {
- evaluateRequestId = sendCommandToWorker("Runtime.evaluate", { "expression": "message_id > 1"});
- }
-
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["id"] === debuggerEnableRequestId) {
- InspectorTest.log("Did enable debugger");
- // Start tight loop in the worker.
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.postMessage(1)" }, didPostMessageToWorker);
- function didPostMessageToWorker()
- {
- InspectorTest.log("Did post message to worker");
- }
- }
- if (message["id"] === evaluateRequestId) {
- var value = message["result"]["result"]["value"];
- if (value === true)
- InspectorTest.log("SUCCESS: evaluated, result: " + value);
- else
- InspectorTest.log("FAIL: evaluated, result: " + value);
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.js
new file mode 100644
index 0000000..ec3325f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker-loop.js
@@ -0,0 +1,54 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker-loop.js')}');
+ var resolve;
+ window.workerMessageReceivedPromise = new Promise(f => resolve = f);
+ window.worker. {
+ if (event.data === 'WorkerMessageReceived')
+ resolve();
+ };
+ `);
+ testRunner.log('Started worker');
+
+ var workerId;
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: false});
+
+ var debuggerEnableRequestId = -1;
+ var evaluateRequestId = -1;
+
+ dp.Target.onReceivedMessageFromTarget(async messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.id === debuggerEnableRequestId) {
+ testRunner.log('Did enable debugger');
+ // Start tight loop in the worker.
+ await dp.Runtime.evaluate({expression: 'worker.postMessage(1)' });
+ testRunner.log('Did post message to worker');
+ }
+ if (message.id === evaluateRequestId) {
+ var value = message.result.result.value;
+ if (value === true)
+ testRunner.log('SUCCESS: evaluated, result: ' + value);
+ else
+ testRunner.log('FAIL: evaluated, result: ' + value);
+ testRunner.completeTest();
+ }
+ });
+
+ workerId = (await dp.Target.onceAttachedToTarget()).params.targetInfo.targetId;
+ testRunner.log('Worker created');
+ testRunner.log('didConnectToWorker');
+ // Enable debugger so that V8 can interrupt and handle inspector commands while there is a script running in a tight loop.
+ debuggerEnableRequestId = sendCommandToWorker('Debugger.enable', {});
+
+ await session.evaluateAsync('workerMessageReceivedPromise');
+ evaluateRequestId = sendCommandToWorker('Runtime.evaluate', { 'expression': 'message_id > 1'});
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.html
deleted file mode 100644
index 1d33b8d..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-
-var worker;
-
-function startWorkerAndRunTest()
-{
- worker = new Worker("resources/dedicated-worker.js");
- worker. { };
- worker.postMessage(1);
- log("Started worker");
- runTest();
-}
-
-
-function test()
-{
-
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId++ })
- });
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: false}, didEnableWorkerDebugging);
-
-
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- InspectorTest.log("didConnectToWorker");
- sendCommandToWorker("Debugger.enable", {});
- sendCommandToWorker("Debugger.pause", {});
- }
-
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["method"] === "Debugger.paused") {
- InspectorTest.log("SUCCESS: Worker paused");
- sendCommandToWorker("Debugger.disable", {});
- InspectorTest.completeTest();
- }
- }
-
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.js
new file mode 100644
index 0000000..90542a2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-dedicated-worker.js
@@ -0,0 +1,35 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: false});
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ var workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+ testRunner.log('didConnectToWorker');
+ sendCommandToWorker('Debugger.enable', {});
+ sendCommandToWorker('Debugger.pause', {});
+
+ dp.Target.onReceivedMessageFromTarget(messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.method === 'Debugger.paused') {
+ testRunner.log('SUCCESS: Worker paused');
+ sendCommandToWorker('Debugger.disable', {});
+ testRunner.completeTest();
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop-expected.txt
index 938e588..a769f3e 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop-expected.txt
@@ -1,4 +1,6 @@
+
didEval
didFireTimer
SUCCESS: Paused
+SUCCESS: Resumed
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.html
deleted file mode 100644
index fac7b51..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function testFunction()
-{
- setTimeout(hotFunction, 0);
-}
-
-var terminated = false;
-function hotFunction() {
- evaluateInFrontend("InspectorTest.didFireTimer()");
-
- var message_id = 1;
- var ts = Date.now();
- while (!terminated) {
- // Without this try/catch v8 will optimize the function and break will not work.
- try {
- if (Date.now() - ts > 1000) {
- ts = Date.now();
- console.error("Message #" + message_id++);
- }
- } catch (e) {
- }
- }
-}
-
-function test()
-{
- InspectorTest.sendCommand("Inspector.enable", {});
- InspectorTest.sendCommand("Debugger.enable", {}, didEnableDebugger);
- function didEnableDebugger()
- {
- // Start tight loop in page.
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" }, didEval);
- function didEval()
- {
- InspectorTest.log("didEval");
- }
- }
-
- InspectorTest.didFireTimer = function()
- {
- InspectorTest.log("didFireTimer");
- InspectorTest.sendCommand("Debugger.pause", { });
- }
-
- InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
- {
- var message = messageObject["params"]["message"];
- InspectorTest.log("SUCCESS: Paused");
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "terminated = true;" });
- InspectorTest.sendCommand("Debugger.resume", { });
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js
new file mode 100644
index 0000000..f56dc97e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js
@@ -0,0 +1,41 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await dp.Runtime.enable();
+ await dp.Debugger.enable();
+
+ // Start tight loop in page.
+ session.evaluate(`
+ var terminated = false;
+ function hotFunction() {
+ console.log('hi');
+ var message_id = 1;
+ var ts = Date.now();
+ while (!terminated) {
+ // Without this try/catch v8 will optimize the function and break will not work.
+ try {
+ if (Date.now() - ts > 1000) {
+ ts = Date.now();
+ console.error('Message #' + message_id++);
+ }
+ } catch (e) {
+ }
+ }
+ }
+ setTimeout(hotFunction, 0);
+ `);
+ testRunner.log('didEval');
+
+ await dp.Runtime.onceConsoleAPICalled();
+ testRunner.log('didFireTimer');
+
+ dp.Debugger.pause();
+ await dp.Debugger.oncePaused();
+ testRunner.log('SUCCESS: Paused');
+
+ dp.Runtime.evaluate({expression: 'terminated = true;' });
+ dp.Debugger.resume();
+ await dp.Debugger.onceResumed();
+ testRunner.log('SUCCESS: Resumed');
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name-expected.txt
index 4b7e1a3..f1a2108 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name-expected.txt
@@ -1,3 +1,4 @@
+
{
result : [
[0] : {
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.html
deleted file mode 100644
index a0357b3..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function testFunction()
-{
- for (var a of [1]) {
- ++a;
- debugger;
- }
-}
-
-function test()
-{
- InspectorTest.sendCommandOrDie("Debugger.enable", {});
- InspectorTest.eventHandler["Debugger.paused"] = dumpScopeOnPause;
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "testFunction()" });
-
- var waitScopeObjects = 0;
- function dumpScopeOnPause(message)
- {
- var scopeChain = message.params.callFrames[0].scopeChain;
- var localScopeObjectIds = [];
- for (var scope of scopeChain) {
- if (scope.type === "local")
- localScopeObjectIds.push(scope.object.objectId);
- }
- waitScopeObjects = localScopeObjectIds.length;
- if (!waitScopeObjects) {
- InspectorTest.completeTest();
- } else {
- for (var objectId of localScopeObjectIds)
- InspectorTest.sendCommandOrDie("Runtime.getProperties", { "objectId" : objectId }, dumpProperties);
- }
- }
-
- function dumpProperties(message)
- {
- InspectorTest.logObject(message);
- --waitScopeObjects;
- if (!waitScopeObjects)
- InspectorTest.sendCommandOrDie("Debugger.resume", {}, () => InspectorTest.completeTest());
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.js
new file mode 100644
index 0000000..a9e8871
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-scope-skip-variables-with-empty-name.js
@@ -0,0 +1,28 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: `
+ function testFunction() {
+ for (var a of [1]) {
+ ++a;
+ debugger;
+ }
+ }
+ testFunction();
+ `});
+
+ var message = await dp.Debugger.oncePaused();
+ var scopeChain = message.params.callFrames[0].scopeChain;
+ var localScopeObjectIds = [];
+ for (var scope of scopeChain) {
+ if (scope.type === 'local')
+ localScopeObjectIds.push(scope.object.objectId);
+ }
+
+ for (var objectId of localScopeObjectIds)
+ testRunner.logObject((await dp.Runtime.getProperties({objectId})).result);
+
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns-expected.txt
index 9b5bec7..287712b 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns-expected.txt
@@ -1,25 +1,26 @@
+
Pattern parser error: Uncaught SyntaxError: Invalid regular expression: /(foo([)/: Unterminated character class
Paused in
(...):1
Paused in
(...):1
Paused in
-qwe:21
-baz:29
+qwe:4
+baz:4
(...):1
Paused in
-bar:7
-foo:13
-qwe:21
-baz:29
+bar:4
+foo:4
+qwe:4
+baz:4
(...):1
Paused in
-qwe:22
-baz:29
+qwe:5
+baz:4
(...):1
Paused in
-qwe:23
-baz:29
+qwe:6
+baz:4
(...):1
Paused in
(...):1
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.html
deleted file mode 100644
index 07ec913271..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-function bar()
-{
- return 42;
-}
-</script>
-<script>
-function foo()
-{
- var a = bar();
- return a + 1;
-}
-//# sourceURL=foo.js
-</script>
-<script>
-function qwe()
-{
- var a = foo();
- return a + 1;
-}
-//# sourceURL=qwe.js
-</script>
-<script>
-function baz()
-{
- var a = qwe();
- return a + 1;
-}
-//# sourceURL=baz.js
-</script>
-<script>
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {});
- InspectorTest.sendCommand("Debugger.setBlackboxPatterns", { patterns: [ "foo([" ] }, dumpError);
-
- function dumpError(message)
- {
- InspectorTest.log(message.error.message);
- InspectorTest.eventHandler["Debugger.paused"] = dumpStackAndRunNextCommand;
- InspectorTest.sendCommandOrDie("Debugger.setBlackboxPatterns", { patterns: [ "baz\.js", "foo\.js" ] });
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "debugger;baz()" });
- }
-
- var commands = [ "stepInto", "stepInto", "stepInto", "stepOut", "stepInto", "stepInto" ];
- function dumpStackAndRunNextCommand(message)
- {
- InspectorTest.log("Paused in");
- var callFrames = message.params.callFrames;
- for (var callFrame of callFrames)
- InspectorTest.log((callFrame.functionName || "(...)") + ":" + (callFrame.location.lineNumber + 1));
- var command = commands.shift();
- if (!command) {
- InspectorTest.completeTest();
- return;
- }
- InspectorTest.sendCommandOrDie("Debugger." + command, {});
- }
-
-}
-</script>
-</head>
-<body >
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.js
new file mode 100644
index 0000000..65cc402
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setBlackboxPatterns.js
@@ -0,0 +1,74 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await session.evaluate(`
+ function bar()
+ {
+ return 42;
+ }
+ `);
+
+ await session.evaluate(`
+ function foo()
+ {
+ var a = bar();
+ return a + 1;
+ }
+ //# sourceURL=foo.js
+ `);
+
+ await session.evaluate(`
+ function qwe()
+ {
+ var a = foo();
+ return a + 1;
+ }
+ //# sourceURL=qwe.js
+ `);
+
+ await session.evaluate(`
+ function baz()
+ {
+ var a = qwe();
+ return a + 1;
+ }
+ //# sourceURL=baz.js
+ `);
+
+ function logStack(message) {
+ testRunner.log('Paused in');
+ var callFrames = message.params.callFrames;
+ for (var callFrame of callFrames)
+ testRunner.log((callFrame.functionName || '(...)') + ':' + (callFrame.location.lineNumber + 1));
+ }
+
+ dp.Debugger.enable();
+ var message = await dp.Debugger.setBlackboxPatterns({patterns: ['foo([']});
+ testRunner.log(message.error.message);
+
+ dp.Debugger.setBlackboxPatterns({patterns: ['baz\.js', 'foo\.js']});
+ dp.Runtime.evaluate({expression: 'debugger;baz()' });
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepInto();
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepInto();
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepInto();
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepOut();
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepInto();
+ logStack(await dp.Debugger.oncePaused());
+
+ dp.Debugger.stepInto();
+ logStack(await dp.Debugger.oncePaused());
+
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
+
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint-expected.txt
index 3b141a7..77c15196 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint-expected.txt
@@ -1,3 +1,4 @@
+
PASS: Debugger was enabled
Error on attempt to set event listener breakpoint when DOM is disabled: undefined
PASS: DOM was enabled
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.html
deleted file mode 100644
index cafebf4f..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {}, setEventListenerBreakpointWhenDOMDisabled);
-
- function finishIfError(message)
- {
- if (message.result)
- return;
- InspectorTest.log("FAIL: " + JSON.stringify(message));
- InspectorTest.completeTest();
- }
-
- function setEventListenerBreakpointWhenDOMDisabled(message)
- {
- finishIfError(message);
- InspectorTest.log("PASS: Debugger was enabled");
- InspectorTest.sendCommand("DOMDebugger.setEventListenerBreakpoint", {'eventName':'click'}, enableDOMAgent);
- }
-
- function enableDOMAgent(message)
- {
- InspectorTest.log("Error on attempt to set event listener breakpoint when DOM is disabled: " + JSON.stringify(message.error));
- InspectorTest.sendCommand("DOM.enable", {}, setEventListenerBreakpoint);
- }
-
- function setEventListenerBreakpoint(message)
- {
- finishIfError(message);
- InspectorTest.log("PASS: DOM was enabled");
- InspectorTest.sendCommand("DOMDebugger.setEventListenerBreakpoint", {'eventName':'click'}, disableDOMAgent);
- }
-
-
- function disableDOMAgent(message)
- {
- finishIfError(message);
- InspectorTest.log("PASS: Listener was set.");
- InspectorTest.sendCommand("DOM.disable", {}, disableDOMAgent2);
- }
-
- function disableDOMAgent2(message)
- {
- finishIfError(message);
- InspectorTest.log("PASS: DOM agent was disabled successfully.");
- InspectorTest.sendCommand("DOM.disable", {}, finish);
- }
-
- function finish(message)
- {
- if (!message.error) {
- InspectorTest.log("FAIL: we expected an error but it wasn't happen.");
- InspectorTest.completeTest();
- return;
- }
-
- InspectorTest.log("PASS: The second attempt to disable DOM agent failed as expected.");
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.js
new file mode 100644
index 0000000..15ff82f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setEventListenerBreakpoint.js
@@ -0,0 +1,32 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function finishIfError(message) {
+ if (message.result)
+ return;
+ testRunner.log('FAIL: ' + JSON.stringify(message));
+ testRunner.completeTest();
+ }
+
+ finishIfError(await dp.Debugger.enable());
+ testRunner.log('PASS: Debugger was enabled');
+
+ var errorResponse = dp.DOMDebugger.setEventListenerBreakpoint({eventName: 'click'});
+ testRunner.log('Error on attempt to set event listener breakpoint when DOM is disabled: ' + JSON.stringify(errorResponse.error));
+
+ finishIfError(await dp.DOM.enable());
+ testRunner.log('PASS: DOM was enabled');
+
+ finishIfError(await dp.DOMDebugger.setEventListenerBreakpoint({eventName:'click'}));
+ testRunner.log('PASS: Listener was set.');
+
+ finishIfError(await dp.DOM.disable());
+ testRunner.log('PASS: DOM agent was disabled successfully.');
+
+ var message = await dp.DOM.disable();
+ if (!message.error)
+ testRunner.log(`FAIL: we expected an error but it wasn't happen.`);
+ else
+ testRunner.log('PASS: The second attempt to disable DOM agent failed as expected.');
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop-expected.txt
index 1eb72fb6..c4ac494 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop-expected.txt
@@ -1,3 +1,4 @@
+
Started worker
Worker created
didConnectToWorker
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
deleted file mode 100644
index fd20f46..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-var worker;
-function startWorkerAndRunTest()
-{
- worker = new Worker("resources/dedicated-worker-string-setTimeout.js");
- log("Started worker");
- runTest();
-}
-
-function test()
-{
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId })
- });
- return workerRequestId++;
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: false}, didEnableWorkerDebugging);
-
- var debuggerEnableRequestId = -1;
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- InspectorTest.log("didConnectToWorker");
- debuggerEnableRequestId = sendCommandToWorker("Debugger.enable", {});
- }
-
- var postMessageToWorker = false;
-
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["id"] === debuggerEnableRequestId) {
- InspectorTest.log("Did enable debugger");
- // Start setTimeout.
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.postMessage(1)" }, didPostMessageToWorker);
- function didPostMessageToWorker()
- {
- postMessageToWorker = true;
- InspectorTest.log("Did post message to worker");
- }
- }
-
- if (postMessageToWorker && message["method"] === "Debugger.scriptParsed") {
- var sourceUrl = message["params"]["url"];
- if (!sourceUrl)
- InspectorTest.log("SUCCESS: script created from string parameter of setTimeout has no url");
- else
- InspectorTest.log("FAIL: script created from string parameter of setTimeout has url " + sourceUrl);
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.js
new file mode 100644
index 0000000..7133bb2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.js
@@ -0,0 +1,47 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker-string-setTimeout.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var workerId;
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: false});
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+ testRunner.log('didConnectToWorker');
+
+ var debuggerEnableRequestId = sendCommandToWorker('Debugger.enable', {});
+ var postMessageToWorker = false;
+ dp.Target.onReceivedMessageFromTarget(async messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.id === debuggerEnableRequestId) {
+ testRunner.log('Did enable debugger');
+ // Start setTimeout.
+ await dp.Runtime.evaluate({expression: 'worker.postMessage(1)'});
+ postMessageToWorker = true;
+ testRunner.log('Did post message to worker');
+ }
+
+ if (postMessageToWorker && message.method === 'Debugger.scriptParsed') {
+ var sourceUrl = message.params.url;
+ if (!sourceUrl)
+ testRunner.log('SUCCESS: script created from string parameter of setTimeout has no url');
+ else
+ testRunner.log('FAIL: script created from string parameter of setTimeout has url ' + sourceUrl);
+ testRunner.completeTest();
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker-expected.txt
index ecdb5d20..776e622 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker-expected.txt
@@ -1,5 +1,4 @@
Tests that dedicated worker won't crash on attempt to step into.Bug 232392.
-
Started worker
Worker created
SUCCESS: Worker paused
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.html
deleted file mode 100644
index 6822980..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-var worker;
-
-function startWorker()
-{
- worker = new Worker("resources/dedicated-worker-step-into.js");
- worker. { };
- worker.postMessage(1);
- log("Started worker");
-}
-
-
-function test()
-{
-
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId++ })
- });
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: true}, didEnableWorkerDebugging);
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()" });
-
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- sendCommandToWorker("Debugger.enable", {});
- sendCommandToWorker("Runtime.runIfWaitingForDebugger", {});
- }
-
- var pauseCount = 0;
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["method"] === "Debugger.paused") {
- InspectorTest.log("SUCCESS: Worker paused");
- if (++pauseCount === 1) {
- InspectorTest.log("Stepping into...");
- sendCommandToWorker("Debugger.stepInto", {});
- } else {
- sendCommandToWorker("Debugger.disable", {});
- InspectorTest.completeTest();
- }
- }
- }
-
-}
-</script>
-</head>
-<body >
-<p>Tests that dedicated worker won't crash on attempt to step into.<a href="https://code.google.com/p/chromium/issues/detail?id=232392">Bug 232392.</a>
-</p>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.js
new file mode 100644
index 0000000..bfb43c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-step-into-dedicated-worker.js
@@ -0,0 +1,41 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank(`Tests that dedicated worker won't crash on attempt to step into.Bug 232392.`);
+
+ var workerId;
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: true});
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker-step-into.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+
+ sendCommandToWorker('Debugger.enable', {});
+ sendCommandToWorker('Runtime.runIfWaitingForDebugger', {});
+
+ var pauseCount = 0;
+ dp.Target.onReceivedMessageFromTarget(async messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.method === 'Debugger.paused') {
+ testRunner.log('SUCCESS: Worker paused');
+ if (++pauseCount === 1) {
+ testRunner.log('Stepping into...');
+ sendCommandToWorker('Debugger.stepInto', {});
+ } else {
+ sendCommandToWorker('Debugger.disable', {});
+ testRunner.completeTest();
+ }
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.html
deleted file mode 100644
index 3919a0f..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-
-var worker;
-
-function startWorkerAndRunTest()
-{
- worker = new Worker("resources/dedicated-worker.js");
- worker. { };
- worker.postMessage(1);
- log("Started worker");
- runTest();
-}
-
-
-function test()
-{
-
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": workerRequestId++ })
- });
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: false}, didEnableWorkerDebugging);
-
-
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- InspectorTest.log("didConnectToWorker");
- sendCommandToWorker("Debugger.enable", {});
- sendCommandToWorker("Debugger.pause", {});
- }
-
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["method"] === "Debugger.paused") {
- InspectorTest.log("Worker paused");
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.terminate()" }, didTerminateWorker);
- }
- }
-
- function didTerminateWorker(messageObject)
- {
- InspectorTest.log("SUCCESS: Did terminate paused worker");
- InspectorTest.completeTest();
- }
-
-}
-</script>
-</head>
-<body that inspected page won't crash if inspected worker is terminated while it is paused. Test passes if it doesn't crash.
-<a href="https://bugs.webkit.org/show_bug.cgi?id=101065">Bug 101065.</a>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.js
new file mode 100644
index 0000000..9c7bf596
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-terminate-dedicated-worker-while-paused.js
@@ -0,0 +1,37 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank(
+ `Test that inspected page won't crash if inspected worker is terminated while it is paused. Test passes if it doesn't crash. Bug 101065.`);
+
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: false});
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ var workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+ testRunner.log('didConnectToWorker');
+ sendCommandToWorker('Debugger.enable', {});
+ sendCommandToWorker('Debugger.pause', {});
+
+ dp.Target.onReceivedMessageFromTarget(async messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.method === 'Debugger.paused') {
+ testRunner.log('Worker paused');
+ await dp.Runtime.evaluate({expression: 'worker.terminate()' });
+ testRunner.log('SUCCESS: Did terminate paused worker');
+ testRunner.completeTest();
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt
index c2d3373..231a947 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt
@@ -1,3 +1,4 @@
+
Event listeners of window
type:click
useCapture:true
@@ -15,14 +16,6 @@
handler.className:Function
handler.description:function hoverHandler(event) { console.log("hover - button - bubbling"); }
- type:load
- useCapture:false
- lineNumber:164
- columnNumber:18
- handler.type:function
- handler.className:Function
- handler.description:function onload(event) { runTest();}
-
type:scroll
useCapture:false
lineNumber:1
@@ -59,8 +52,8 @@
type:load
useCapture:false
- lineNumber:162
- columnNumber:33
+ lineNumber:0
+ columnNumber:38
handler.type:function
handler.className:Function
handler.description:function onload(event) { return 42;}
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html
deleted file mode 100644
index 856dfc7..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function test()
-{
- // A general-purpose engine for sending a sequence of protocol commands.
- // The clients provide requests and response handlers, while the engine catches
- // errors and makes sure that once there's nothing to do completeTest() is called.
- // @param step is an object with command, params and callback fields.
- function runRequestSeries(step)
- {
- processStep(step);
-
- function processStep(s)
- {
- try {
- processStepOrFail(s);
- } catch (e) {
- InspectorTest.log(e.stack);
- InspectorTest.completeTest();
- }
- }
-
- function processStepOrFail(s)
- {
- if (!s) {
- InspectorTest.completeTest();
- return;
- }
- if (!s.command) {
- // A simple loopback step.
- var next = s.callback();
- processStep(next);
- return;
- }
-
- var innerCallback = function(response)
- {
- if ("error" in response) {
- InspectorTest.log(response.error.message);
- InspectorTest.completeTest();
- return;
- }
- var next;
- try {
- next = s.callback(response.result);
- } catch (e) {
- InspectorTest.log(e.stack);
- InspectorTest.completeTest();
- return;
- }
- processStep(next);
- }
- InspectorTest.sendCommand(s.command, s.params, innerCallback);
- }
- }
-
- runRequestSeries({ callback: callbackStartWindow });
-
- function callbackStartWindow()
- {
- var expression = "(function(){\n\
- window.addEventListener('scroll', function(){ consol.log(42) }, false);\n\
- window.addEventListener('scroll', function(){ consol.log(42) }, false);\n\
- function clickHandler(event) { console.log('click - button - bubbling (registered before attribute)'); }\n\
- window.addEventListener(\"click\", clickHandler, true);\n\
- window.addEventListener(\"hover\", function hoverHandler(event) { console.log(\"hover - button - bubbling\"); }, true);\n\
- return window;\n\
- })()";
- return { command: "Runtime.evaluate", params: {expression: expression, objectGroup: "event-listeners-test"}, callback: callbackEvalWindow };
- }
- function callbackEvalWindow(result)
- {
- var id = result.result.objectId;
- if (id === undefined)
- throw new Error("objectId is expected");
- return {
- command: "DOMDebugger.getEventListeners", params: {objectId: id}, callback: callbackListenersWindow
- };
- }
- function callbackListenersWindow(result)
- {
- logGetListenersResult("window", result);
- return {callback: calbackStartDivWithListeners};
- }
-
- function calbackStartDivWithListeners()
- {
- var expression = "(function(){\n\
- var div = document.getElementById(\"listeners1\");\n\
- function clickHandler(event) { console.log('click - button - bubbling (registered before attribute)'); }\n\
- div.addEventListener(\"click\", clickHandler, true);\n\
- div.addEventListener(\"hover\", function hoverHandler(event) { console.log(\"hover - button - bubbling\"); }, true);\n\
- return div;\n\
- })()";
- return { command: "Runtime.evaluate", params: {expression: expression, objectGroup: "event-listeners-test"}, callback: callbackEvalDivWithListeners };
- }
- function callbackEvalDivWithListeners(result)
- {
- var id = result.result.objectId;
- if (id === undefined)
- throw new Error("objectId is expected");
- return {
- command: "DOMDebugger.getEventListeners", params: {objectId: id}, callback: callbackListenersDivWithListeners
- };
- }
- function callbackListenersDivWithListeners(result)
- {
- logGetListenersResult("div#listeners1", result);
- return {callback: calbackStartDivWithoutListeners};
- }
-
- function calbackStartDivWithoutListeners()
- {
- var expression = "(function(){\n\
- return document.getElementById(\"listeners2\");\n\
- })()";
- return { command: "Runtime.evaluate", params: {expression: expression, objectGroup: "event-listeners-test"}, callback: callbackEvalDivWithoutListeners };
- }
- function callbackEvalDivWithoutListeners(result)
- {
- var id = result.result.objectId;
- if (id === undefined)
- throw new Error("objectId is expected");
- return {
- command: "DOMDebugger.getEventListeners", params: {objectId: id}, callback: callbackListenersDivWithoutListeners
- };
- }
- function callbackListenersDivWithoutListeners(result)
- {
- logGetListenersResult("div#listeners2", result);
- }
-
- function logGetListenersResult(title, protocolResult)
- {
- InspectorTest.log("Event listeners of " + title);
- var listenersArray = protocolResult.listeners;
- listenersArray.sort(TypedThingComparator);
- for (var i = 0; i < listenersArray.length; i++) {
- var l = listenersArray[i];
- InspectorTest.log(" type:" + l.type);
- InspectorTest.log(" useCapture:" + l.useCapture);
- InspectorTest.log(" lineNumber:" + l.lineNumber);
- InspectorTest.log(" columnNumber:" + l.columnNumber);
- if (l.handler) {
- InspectorTest.log(" handler.type:" + l.handler.type);
- InspectorTest.log(" handler.className:" + l.handler.className);
- InspectorTest.log(" handler.description:" + l.handler.description.replace(/(\r\n|\n|\r)/gm,""));
- }
- InspectorTest.log("");
- }
- InspectorTest.log("");
- function TypedThingComparator(o1, o2)
- {
- return o1.type === o2.type ? 0 : (o1.type < o2.type ? -1 : 1);
- }
- }
-}
-</script>
-</head>
-<div id="listeners1" 42;"></div>
-<div id="listeners2"></div>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.js
new file mode 100644
index 0000000..3a7b1dd2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners.js
@@ -0,0 +1,57 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <div id='listeners1' ></div>
+ <div id='listeners2'></div>
+ `, ``);
+
+ function logGetListenersResult(title, response) {
+ testRunner.log('Event listeners of ' + title);
+ var listenersArray = response.result.listeners;
+ listenersArray.sort((o1, o2) => o1.type === o2.type ? 0 : (o1.type < o2.type ? -1 : 1));
+ for (var l of listenersArray) {
+ testRunner.log(' type:' + l.type);
+ testRunner.log(' useCapture:' + l.useCapture);
+ testRunner.log(' lineNumber:' + l.lineNumber);
+ testRunner.log(' columnNumber:' + l.columnNumber);
+ if (l.handler) {
+ testRunner.log(' handler.type:' + l.handler.type);
+ testRunner.log(' handler.className:' + l.handler.className);
+ testRunner.log(' handler.description:' + l.handler.description.replace(/(\r\n|\n|\r)/gm,''));
+ }
+ testRunner.log('');
+ }
+ testRunner.log('');
+ }
+
+ var objectId = (await dp.Runtime.evaluate({expression:
+ `(function(){
+ window.addEventListener('scroll', function(){ consol.log(42) }, false);
+ window.addEventListener('scroll', function(){ consol.log(42) }, false);
+ function clickHandler(event) { console.log('click - button - bubbling (registered before attribute)'); }
+ window.addEventListener('click', clickHandler, true);
+ window.addEventListener('hover', function hoverHandler(event) { console.log("hover - button - bubbling"); }, true);
+ return window;
+ })()
+ `, objectGroup: 'event-listeners-test'})).result.result.objectId;
+ logGetListenersResult('window', await dp.DOMDebugger.getEventListeners({objectId}));
+
+ var objectId = (await dp.Runtime.evaluate({expression:
+ `(function(){
+ var div = document.getElementById('listeners1');
+ function clickHandler(event) { console.log('click - button - bubbling (registered before attribute)'); }
+ div.addEventListener('click', clickHandler, true);
+ div.addEventListener('hover', function hoverHandler(event) { console.log("hover - button - bubbling"); }, true);
+ return div;
+ })()
+ `, objectGroup: 'event-listeners-test'})).result.result.objectId;
+ logGetListenersResult('div#listeners1', await dp.DOMDebugger.getEventListeners({objectId}));
+
+ var objectId = (await dp.Runtime.evaluate({expression:
+ `(function(){
+ return document.getElementById('listeners2');
+ })()
+ `, objectGroup: 'event-listeners-test'})).result.result.objectId;
+ logGetListenersResult('div#listeners2', await dp.DOMDebugger.getEventListeners({objectId}));
+
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp-expected.txt
index 0c0a485..a6902f5 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp-expected.txt
@@ -1,10 +1,4 @@
-CONSOLE ERROR: line 2: Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
-CONSOLE ERROR: line 4: Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-bhHHL3z2vDgxUt0W3dWQOrprscmda2Y5pLsLg4GF+pI='), or a nonce ('nonce-...') is required to enable inline execution.
-
-CONSOLE ERROR: line 5: Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
-
-Button
-------
blockedEventHandler
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.html
deleted file mode 100644
index 1fb01011..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Security-Policy" content="script-src 'self';">
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script type="text/javascript" src="resources/script-blocked-by-csp.js"></script>
-</head>
-<body>
-<button id="testButton" >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.js
new file mode 100644
index 0000000..8f700db
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-script-blocked-by-csp.js
@@ -0,0 +1,55 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <html>
+ <head>
+ <meta http-equiv='Content-Security-Policy' content="script-src 'self';">
+ </head>
+ <body>
+ <button id='testButton' >Button</button>
+ </body>
+ </html>
+ `, ``);
+
+ dp.Debugger.enable();
+ dp.DOM.enable();
+ dp.DOMDebugger.enable();
+ dp.DOMDebugger.setInstrumentationBreakpoint({eventName: 'scriptBlockedByCSP'});
+
+ var expressions = [
+ `
+ document.getElementById('testButton').click();
+ `,
+
+ `
+ var script = document.createElement('script');
+ script.innerText = 'alert(1)';
+ document.body.appendChild(script);
+ `,
+
+ `
+ var a = document.createElement('a');
+ a.setAttribute('href', 'javascript:alert(1);');
+ var dummy = 1;
+ document.body.appendChild(a); a.click();
+ `
+ ];
+ var descriptions = [
+ 'blockedEventHandler',
+ 'blockedScriptInjection',
+ 'blockedScriptUrl'
+ ];
+
+ for (var i = 0; i < expressions.length; i++) {
+ var funcName = descriptions[i];
+ testRunner.log('\n-------\n' + funcName);
+ dp.Runtime.evaluate({expression: 'function ' + funcName + '() {' + expressions[i] + '}\n' + funcName + '()'});
+ var messageObject = await dp.Debugger.oncePaused();
+ var params = messageObject.params;
+ testRunner.log('Paused at: ' + params.callFrames[0].functionName + '@' + params.callFrames[0].location.lineNumber);
+ testRunner.log('Reason: ' + params.reason + '; Data:');
+ testRunner.logObject(params.data);
+ await dp.Debugger.resume();
+ }
+
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML-expected.txt
index a97b8e52..4dce98314 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML-expected.txt
@@ -1,3 +1,3 @@
-innerHTML
+
Paused on the innerHTML assignment: modifyHTML@:7
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.html
deleted file mode 100644
index bb8c99d63..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function modifyHTML()
-{
- document.getElementById("divUnderTest").innerHTML = "innerHTML";
-}
-
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {});
- InspectorTest.sendCommand("DOM.enable", {});
- InspectorTest.sendCommand("DOMDebugger.enable", {});
- InspectorTest.sendCommand("DOMDebugger.setInstrumentationBreakpoint", {"eventName":"Element.setInnerHTML"});
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "modifyHTML()" });
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne;
-
- function handleDebuggerPausedOne(messageObject)
- {
- var callFrame = messageObject.params.callFrames[0];
- InspectorTest.log("Paused on the innerHTML assignment: " + callFrame.functionName + "@:" + callFrame.location.lineNumber);
- InspectorTest.sendCommand("Debugger.resume", { }, didResume);
- function didResume()
- {
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-<div id="divUnderTest"></div>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.js
new file mode 100644
index 0000000..486242e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-setInnerHTML.js
@@ -0,0 +1,25 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <div id='divUnderTest'></div>
+ `, ``);
+
+ dp.Debugger.enable();
+ dp.DOM.enable();
+ dp.DOMDebugger.enable();
+ dp.DOMDebugger.setInstrumentationBreakpoint({eventName: 'Element.setInnerHTML'});
+ dp.Runtime.evaluate({expression: `
+
+
+
+
+
+ (function modifyHTML() {
+ document.getElementById('divUnderTest').innerHTML = 'innerHTML';
+ })()
+ ` });
+ var messageObject = await dp.Debugger.oncePaused();
+ var callFrame = messageObject.params.callFrames[0];
+ testRunner.log('Paused on the innerHTML assignment: ' + callFrame.functionName + '@:' + callFrame.location.lineNumber);
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause-expected.txt
index 568693f..96cf4515 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause-expected.txt
@@ -1,3 +1,4 @@
+
Paused on 'debugger;'
PASS: message has not been dispatched yet.
PASS: message has not been dispatched yet.
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.html
deleted file mode 100644
index 7cb5fbc..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-var messageDispatched = false;
-window.addEventListener("message", function(event)
-{
- messageDispatched = true;
- debugger;
-}, true);
-
-function testFunction()
-{
- window.postMessage("test", "*");
- debugger;
-}
-
-function test()
-{
- InspectorTest.sendCommand("Debugger.enable", {});
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedInTestFunction;
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" });
-
- function handleDebuggerPausedInTestFunction(messageObject)
- {
- InspectorTest.log("Paused on 'debugger;'");
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "messageDispatched" }, didEvaluateOnPause1);
- }
-
- function didEvaluateOnPause1(messageObject)
- {
- var r = messageObject.result.result;
- if (r.type === "boolean" && r.value === false)
- InspectorTest.log("PASS: message has not been dispatched yet.");
- else
- InspectorTest.log("FAIL: unexpected response " + JSON.stringify(messageObject, null, 2));
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "messageDispatched" }, didEvaluateOnPause2);
- }
-
- function didEvaluateOnPause2(messageObject)
- {
- var r = messageObject.result.result;
- if (r.type === "boolean" && r.value === false)
- InspectorTest.log("PASS: message has not been dispatched yet.");
- else
- InspectorTest.log("FAIL: unexpected response " + JSON.stringify(messageObject, null, 2));
- InspectorTest.sendCommand("Debugger.resume", { }, didResume);
- }
-
- function didResume(messageObject)
- {
- InspectorTest.log("Resumed, now waiting for pause in the event listener...");
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedInEventListener;
- }
-
- function handleDebuggerPausedInEventListener(messageObject)
- {
- InspectorTest.log("PASS: pasued in the event listener.");
- InspectorTest.sendCommand("Debugger.resume", { }, didResume2);
- }
-
- function didResume2(messageObject)
- {
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.js
new file mode 100644
index 0000000..6a2b7b1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/postMessage-on-pause.js
@@ -0,0 +1,42 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: `
+ var messageDispatched = false;
+ window.addEventListener('message', event => {
+ messageDispatched = true;
+ debugger;
+ }, true);
+
+ (function testFunction() {
+ window.postMessage('test', '*');
+ debugger;
+ })()
+ `});
+
+ await dp.Debugger.oncePaused();
+ testRunner.log(`Paused on 'debugger;'`);
+
+ var messageObject = await dp.Runtime.evaluate({expression: 'messageDispatched' });
+ var r = messageObject.result.result;
+ if (r.type === 'boolean' && r.value === false)
+ testRunner.log('PASS: message has not been dispatched yet.');
+ else
+ testRunner.log('FAIL: unexpected response ' + JSON.stringify(messageObject, null, 2));
+
+ messageObject = await dp.Runtime.evaluate({expression: 'messageDispatched' });
+ r = messageObject.result.result;
+ if (r.type === 'boolean' && r.value === false)
+ testRunner.log('PASS: message has not been dispatched yet.');
+ else
+ testRunner.log('FAIL: unexpected response ' + JSON.stringify(messageObject, null, 2));
+
+ await dp.Debugger.resume();
+ testRunner.log('Resumed, now waiting for pause in the event listener...');
+
+ await dp.Debugger.oncePaused();
+ testRunner.log('PASS: pasued in the event listener.');
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/blackboxed.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/blackboxed.js
deleted file mode 100644
index 51da71a..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/blackboxed.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function blackboxedBoo()
-{
- var a = 42;
- var b = foo();
- return a + b;
-}
-//# sourceURL=blackboxed-script.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/mixed.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/mixed.js
deleted file mode 100644
index df01a0e9..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/mixed.js
+++ /dev/null
@@ -1,21 +0,0 @@
-function notBlackboxedFoo()
-{
- var a = 42;
- var b = blackboxedBoo();
- return a + b;
-}
-
-function blackboxedFoo()
-{
- var a = 42;
- var b = notBlackboxedFoo();
- return a + b;
-}
-
-function notBlackboxedBoo()
-{
- var a = 42;
- var b = blackboxedFoo();
- return a + b;
-}
-//# sourceURL=mixed-source.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
deleted file mode 100644
index 31a5ce5..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/script-blocked-by-csp.js
+++ /dev/null
@@ -1,50 +0,0 @@
-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));
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/statements.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/statements.js
deleted file mode 100644
index cec8a12..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/resources/statements.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function statementsExample()
-{
- var self = arguments.callee;
-
- debugger;
-
- self.step = 1;
-
- self.step = 2;
-
- void [
- self.step = 3,
- self.step = 4,
- self.step = 5,
- self.step = 6
- ];
-
- self.step = 7;
-}
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash-expected.txt
index 237f325..b5a0f54 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash-expected.txt
@@ -1,3 +1,4 @@
+
Hash received: 1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18
Hash received: EBF1ECD351E7A3294CB5762843D429DC872EBA18
Hash received: 22D0043331237371241FC675A984B967025A3DC0
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.html
deleted file mode 100644
index d441cb1..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-function test()
-{
- var hashes = new Set(["1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18",
- "EBF1ECD351E7A3294CB5762843D429DC872EBA18",
- "22D0043331237371241FC675A984B967025A3DC0"]);
- InspectorTest.sendCommandOrDie("Debugger.enable", {}, function() {
- InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
- {
- if (hashes.has(messageObject.params.hash))
- InspectorTest.log("Hash received: " + messageObject.params.hash);
- }
- });
-
- function longScript() {
- var longScript = "var b = 1;";
- for (var i = 0; i < 2024; ++i)
- longScript += "++b;";
- }
-
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "1" });
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "239" });
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "(" + longScript + ")()" }, step2);
-
- function step2()
- {
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.js
new file mode 100644
index 0000000..8e5db35c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/scriptParsedHash.js
@@ -0,0 +1,24 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ var hashes = new Set(['1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18',
+ 'EBF1ECD351E7A3294CB5762843D429DC872EBA18',
+ '22D0043331237371241FC675A984B967025A3DC0']);
+
+ dp.Debugger.enable();
+ dp.Debugger.onScriptParsed(messageObject => {
+ if (hashes.has(messageObject.params.hash))
+ testRunner.log('Hash received: ' + messageObject.params.hash);
+ });
+
+ function longScript() {
+ var longScript = "var b = 1;";
+ for (var i = 0; i < 2024; ++i)
+ longScript += "++b;";
+ }
+
+ dp.Runtime.evaluate({expression: '1'});
+ dp.Runtime.evaluate({expression: '239'});
+ await dp.Runtime.evaluate({expression: '(' + longScript + ')()' });
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource-expected.txt
index 1b76ec5..9e355e2 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource-expected.txt
@@ -1,3 +1,4 @@
+
Function evaluate: {"type":"number","value":6,"description":"6"}
PASS, result value: 6
Function evaluate: {"type":"number","value":8,"description":"8"}
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
deleted file mode 100644
index 9bdb671..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
+++ /dev/null
@@ -1,156 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script type="text/javascript" src="resources/liveedit-me.js"></script>
-<script>
-
-function test()
-{
- // A general-purpose engine for sending a sequence of protocol commands.
- // The clients provide requests and response handlers, while the engine catches
- // errors and makes sure that once there's nothing to do completeTest() is called.
- // @param step is an object with command, params and callback fields
- function runRequestSeries(step) {
- processStep(step);
-
- function processStep(currentStep) {
- try {
- processStepOrFail(currentStep);
- } catch (e) {
- InspectorTest.log(e.stack);
- InspectorTest.completeTest();
- }
- }
-
- function processStepOrFail(currentStep) {
- if (!currentStep) {
- InspectorTest.completeTest();
- return;
- }
- if (!currentStep.command) {
- // A simple loopback step.
- var next = currentStep.callback();
- processStep(next);
- return;
- }
-
- var innerCallback = function(response) {
- var next;
- if ("error" in response) {
- if (!("errorHandler" in currentStep)) {
- // Error message is not logged intentionally, it may be platform-specific.
- InspectorTest.log("Protocol command '" + currentStep.command + "' failed");
- InspectorTest.completeTest();
- return;
- }
- try {
- next = currentStep.errorHandler(response.error);
- } catch (e) {
- InspectorTest.log(e.stack);
- InspectorTest.completeTest();
- return;
- }
- } else {
- try {
- next = currentStep.callback(response.result);
- } catch (e) {
- InspectorTest.log(e.stack);
- InspectorTest.completeTest();
- return;
- }
- }
- processStep(next);
- }
- InspectorTest.sendCommand(currentStep.command, currentStep.params, innerCallback);
- }
- }
-
- function logEqualsCheck(actual, expected)
- {
- if (actual == expected) {
- InspectorTest.log("PASS, result value: " + actual);
- } else {
- InspectorTest.log("FAIL, actual value: " + actual + ", expected: " + expected);
- }
- }
- function logCheck(description, success)
- {
- InspectorTest.log(description + ": " + (success ? "PASS" : "FAIL"));
- }
-
- var firstStep = { callback: enableDebugger };
-
- runRequestSeries(firstStep);
-
- function enableDebugger() {
- return { command: "Debugger.enable", params: {}, callback: evalFunction };
- }
-
- function evalFunction(response) {
- var expression = "TestExpression(2, 4)";
- return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction };
- }
-
- function callbackEvalFunction(result) {
- InspectorTest.log("Function evaluate: " + JSON.stringify(result.result));
- logEqualsCheck(result.result.value, 6);
-
- return { command: "Runtime.evaluate", params: { expression: "TestExpression" }, callback: callbackEvalFunctionObject };
- }
-
- function callbackEvalFunctionObject(result) {
- return { command: "Runtime.getProperties", params: { objectId: result.result.objectId }, callback: callbackFunctionDetails };
- }
-
- function callbackFunctionDetails(result)
- {
- var scriptId;
- for (var prop of result.internalProperties) {
- if (prop.name === "[[FunctionLocation]]")
- scriptId = prop.value.value.scriptId;
- }
- return createScriptManipulationArc(scriptId, null);
- }
-
- // Several steps with scriptId in context.
- function createScriptManipulationArc(scriptId, next) {
- return { command: "Debugger.getScriptSource", params: { scriptId: scriptId }, callback: callbackGetScriptSource };
-
- var originalText;
-
- function callbackGetScriptSource(result) {
- originalText = result.scriptSource;
- var patched = originalText.replace("a + b", "a * b");
-
- return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: callbackSetScriptSource };
- }
-
- function callbackSetScriptSource(result) {
- var expression = "TestExpression(2, 4)";
- return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction2 };
- }
-
- function callbackEvalFunction2(result) {
- InspectorTest.log("Function evaluate: " + JSON.stringify(result.result));
- logEqualsCheck(result.result.value, 8);
-
- var patched = originalText.replace("a + b", "a # b");
-
- return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: errorCallbackSetScriptSource2 };
- }
-
- function errorCallbackSetScriptSource2(result) {
- var exceptionDetails = result.exceptionDetails;
- logCheck("Has error reported", !!exceptionDetails);
- logCheck("Reported error is a compile error", !!exceptionDetails);
- if (exceptionDetails)
- logEqualsCheck(exceptionDetails.lineNumber, 1);
- return next;
- }
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.js
new file mode 100644
index 0000000..31b4f61
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.js
@@ -0,0 +1,46 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function logEqualsCheck(actual, expected) {
+ if (actual == expected) {
+ testRunner.log('PASS, result value: ' + actual);
+ } else {
+ testRunner.log('FAIL, actual value: ' + actual + ', expected: ' + expected);
+ }
+ }
+
+ await session.evaluate(
+ `function TestExpression(a, b) {
+ return a + b;
+ }`);
+
+ await dp.Debugger.enable();
+
+ var response = await dp.Runtime.evaluate({expression: 'TestExpression(2, 4)' });
+ testRunner.log('Function evaluate: ' + JSON.stringify(response.result.result));
+ logEqualsCheck(response.result.result.value, 6);
+
+ var functionObjectId = (await dp.Runtime.evaluate({expression: 'TestExpression' })).result.result.objectId;
+ var result = (await dp.Runtime.getProperties({ objectId: functionObjectId})).result;
+ var scriptId;
+ for (var prop of result.internalProperties) {
+ if (prop.name === '[[FunctionLocation]]')
+ scriptId = prop.value.value.scriptId;
+ }
+
+ var originalText = (await dp.Debugger.getScriptSource({scriptId})).result.scriptSource;
+ var patched = originalText.replace('a + b', 'a * b');
+ await dp.Debugger.setScriptSource({scriptId, scriptSource: patched});
+
+ var response = await dp.Runtime.evaluate({expression: 'TestExpression(2, 4)' });
+ testRunner.log('Function evaluate: ' + JSON.stringify(response.result.result));
+ logEqualsCheck(response.result.result.value, 8);
+
+ patched = originalText.replace('a + b', 'a # b');
+ var exceptionDetails = (await dp.Debugger.setScriptSource({scriptId, scriptSource: patched})).result.exceptionDetails;
+ testRunner.log(`Has error reported: ${!!exceptionDetails ? 'PASS' : 'FAIL'}`, );
+ testRunner.log(`Reported error is a compile error: ${!!exceptionDetails ? 'PASS' : 'FAIL'}`, );
+ if (exceptionDetails)
+ logEqualsCheck(exceptionDetails.lineNumber, 1);
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.html
deleted file mode 100644
index e120131..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function testFunction()
-{
- var e = document.getElementById("div");
- debugger;
- e.click();
-}
-
-function shouldNotBeThisFunction()
-{
- return 239;
-}
-
-function test()
-{
- InspectorTest.waitForEventPromise("Debugger.paused").then(makeStepping);
-
- InspectorTest.sendCommandPromise("Debugger.enable", {})
- .then((result) => InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "testFunction()" }))
- .then(() => InspectorTest.completeTest());
-
- function makeStepping()
- {
- sendCommandAndWaitForPause("Debugger.stepInto")
- .then(() => sendCommandAndWaitForPause("Debugger.stepInto"))
- .then((result) => dumpTopCallFrame(result))
- .then(() => InspectorTest.sendCommandPromise("Debugger.resume"));
- }
-
- function sendCommandAndWaitForPause(command)
- {
- InspectorTest.sendCommand(command, {});
- return InspectorTest.waitForEventPromise("Debugger.paused");
- }
-
- function dumpTopCallFrame(result)
- {
- var frame = result.params.callFrames[0];
- InspectorTest.log("functionName (should be empty): " + (frame.functionName.length ? frame.functionName : "empty"));
- }
-}
-</script>
-</head>
-<div id="div" >
-</div>
-<body >
-Tests that Debugger.stepInto doesn't ignore inline event listeners.
-</body>
-</html>
-
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.js
new file mode 100644
index 0000000..9d71b342
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-into-inline-event-handler.js
@@ -0,0 +1,35 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <script>
+ function testFunction() {
+ var e = document.getElementById('div');
+ debugger;
+ e.click();
+ }
+
+ function shouldNotBeThisFunction() {
+ return 239;
+ }
+ </script>
+ <div id='div' ></div>
+ `, `Tests that Debugger.stepInto doesn't ignore inline event listeners.`);
+
+
+ function dumpTopCallFrame(result) {
+ var frame = result.params.callFrames[0];
+ testRunner.log('functionName (should be empty): ' + (frame.functionName.length ? frame.functionName : 'empty'));
+ }
+
+ await dp.Debugger.enable();
+ var finished = dp.Runtime.evaluate({expression: 'testFunction()'});
+
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepInto();
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepInto();
+ dumpTopCallFrame(await dp.Debugger.oncePaused());
+ dp.Debugger.resume();
+
+ await finished;
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception-expected.txt
index 78aaf35..e6ce4af 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception-expected.txt
@@ -1,5 +1,4 @@
-CONSOLE MESSAGE: line 16: completed
-CONSOLE MESSAGE: line 16: completed
+
testFunction:13
testFunction:15
testFunction:13
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.html
deleted file mode 100644
index 1da33950..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-function testFunction()
-{
- function foo()
- {
- try {
- throw new Error();
- } catch (e) {
- }
- }
- debugger;
- foo();
- console.log("completed");
-}
-</script>
-<script>
-function test()
-{
- InspectorTest.sendCommandOrDie("Debugger.enable", {} );
- InspectorTest.sendCommandOrDie("Runtime.enable", {} );
- step1();
-
- function step1()
- {
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setTimeout(testFunction, 0);"} );
- var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ];
- InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
- {
- var command = commands.shift();
- if (command === "Print") {
- var callFrames = messageObject.params.callFrames;
- for (var callFrame of callFrames)
- InspectorTest.log(callFrame.functionName + ":" + callFrame.location.lineNumber);
- command = commands.shift();
- }
- if (command)
- InspectorTest.sendCommandOrDie("Debugger." + command, {});
- }
-
- InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messageObject)
- {
- if (messageObject.params.args[0].value === "completed") {
- if (commands.length)
- InspectorTest.log("[FAIL]: execution was resumed too earlier.")
- step2();
- }
- }
- }
-
- function step2()
- {
- InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setTimeout(testFunction, 0);"} );
- var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver", "Print", "resume" ];
- InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
- {
- var command = commands.shift();
- if (command === "Print") {
- var callFrames = messageObject.params.callFrames;
- for (var callFrame of callFrames)
- InspectorTest.log(callFrame.functionName + ":" + callFrame.location.lineNumber);
- command = commands.shift();
- }
- if (command)
- InspectorTest.sendCommandOrDie("Debugger." + command, {});
- }
-
- InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messageObject)
- {
- if (messageObject.params.args[0].value === "completed") {
- if (commands.length)
- InspectorTest.log("[FAIL]: execution was resumed too earlier.")
- InspectorTest.completeTest();
- }
- }
- }
-}
-</script>
-</head>
-<body >
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.js
new file mode 100644
index 0000000..a30526d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/step-over-caught-exception.js
@@ -0,0 +1,54 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ dp.Debugger.enable();
+ dp.Runtime.enable();
+ dp.Runtime.evaluate({expression: `
+
+
+
+
+
+ function testFunction() {
+ function foo() {
+ try {
+ throw new Error();
+ } catch (e) {
+ }
+ }
+ debugger;
+ foo();
+ console.log('completed');
+ }
+ setTimeout(testFunction, 0);
+ `});
+
+ function printCallFrames(messageObject) {
+ var callFrames = messageObject.params.callFrames;
+ for (var callFrame of callFrames)
+ testRunner.log(callFrame.functionName + ':' + callFrame.location.lineNumber);
+ }
+
+ printCallFrames(await dp.Debugger.oncePaused());
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepOver();
+ printCallFrames(await dp.Debugger.oncePaused());
+ dp.Debugger.resume();
+ await dp.Runtime.onceConsoleAPICalled(messageObject => messageObject.params.args[0].value === 'completed');
+
+ dp.Runtime.evaluate({expression: 'setTimeout(testFunction, 0);'} );
+ printCallFrames(await dp.Debugger.oncePaused());
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepInto();
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ dp.Debugger.stepOver();
+ printCallFrames(await dp.Debugger.oncePaused());
+ dp.Debugger.resume();
+ await dp.Runtime.onceConsoleAPICalled(messageObject => messageObject.params.args[0].value === 'completed');
+
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges-expected.txt
index 2969deb..10cc9e4 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges-expected.txt
@@ -1,3 +1,4 @@
+
foo: 14:4
blackboxedBoo: 3:12
notBlackboxedFoo: 3:12
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.html
deleted file mode 100644
index cbb17ec..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script type="text/javascript" src="resources/blackboxed.js"></script>
-<script type="text/javascript" src="resources/mixed.js"></script>
-<script>
-function testFunction()
-{
- notBlackboxedBoo(); // for setup ranges and stepOut
- notBlackboxedBoo(); // for stepIn
-}
-
-function foo()
-{
- debugger;
- return 239;
-}
-</script>
-<script>
-function test()
-{
- InspectorTest.eventHandler["Debugger.paused"] = setBlackboxedScriptRanges;
- InspectorTest.sendCommandOrDie("Debugger.enable", {}, callTestFunction);
-
- function callTestFunction(response)
- {
- InspectorTest.evaluateInInspectedPage("setTimeout(testFunction, 0);");
- }
-
- function setBlackboxedScriptRanges(response)
- {
- var callFrames = response.params.callFrames;
- printCallFrames(callFrames);
- InspectorTest.sendCommand("Debugger.setBlackboxedRanges", {
- scriptId: callFrames[1].location.scriptId,
- positions: [ { lineNumber: 0, columnNumber: 0 } ] // blackbox ranges for blackboxed.js
- }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId));
- }
-
- var incorrectPositions = [
- [ { lineNumber: 0, columnNumber: 0 }, { lineNumber: 0, columnNumber: 0 } ],
- [ { lineNumber: 0, columnNumber: 1 }, { lineNumber: 0, columnNumber: 0 } ],
- [ { lineNumber: 0, columnNumber: -1 } ],
- ];
-
- function setIncorrectRanges(scriptId, response)
- {
- if (response.error)
- InspectorTest.log(response.error.message);
- var positions = incorrectPositions.shift();
- if (!positions) {
- setMixedSourceRanges(scriptId);
- return;
- }
- InspectorTest.log("Try to set positions: " + JSON.stringify(positions));
- InspectorTest.sendCommand("Debugger.setBlackboxedRanges", {
- scriptId: scriptId,
- positions: positions
- }, setIncorrectRanges.bind(null, scriptId));
- }
-
- function setMixedSourceRanges(scriptId)
- {
- InspectorTest.eventHandler["Debugger.paused"] = runAction;
- InspectorTest.sendCommandOrDie("Debugger.setBlackboxedRanges", {
- scriptId: scriptId,
- positions: [ { lineNumber: 6, columnNumber: 0 }, { lineNumber: 14, columnNumber: 0 } ] // blackbox ranges for mixed.js
- }, runAction);
- }
-
- var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print",
- "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepInto", "print",
- "stepOver", "stepInto", "print" ];
-
- function runAction(response)
- {
- var action = actions.shift();
- if (!action)
- InspectorTest.completeTest();
-
- if (action === "print") {
- printCallFrames(response.params.callFrames);
- runAction({});
- } else {
- InspectorTest.log("action: " + action);
- InspectorTest.sendCommandOrDie("Debugger." + action, {});
- }
- }
-
- function printCallFrames(callFrames)
- {
- var topCallFrame = callFrames[0];
- if (topCallFrame.functionName.startsWith("blackboxed"))
- InspectorTest.log("FAIL: blackboxed function in top call frame");
- for (var callFrame of callFrames)
- InspectorTest.log(callFrame.functionName + ': ' + callFrame.location.lineNumber + ":" + callFrame.location.columnNumber);
- InspectorTest.log("");
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js
new file mode 100644
index 0000000..49757284
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js
@@ -0,0 +1,131 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function printCallFrames(response) {
+ var callFrames = response.params.callFrames;
+ var topCallFrame = callFrames[0];
+ if (topCallFrame.functionName.startsWith('blackboxed'))
+ testRunner.log('FAIL: blackboxed function in top call frame');
+ for (var callFrame of callFrames)
+ testRunner.log(callFrame.functionName + ': ' + callFrame.location.lineNumber + ':' + callFrame.location.columnNumber);
+ testRunner.log('');
+ }
+
+ function printError(response) {
+ if (response.error)
+ testRunner.log(response.error.message);
+ }
+
+ await session.evaluate(
+`function blackboxedBoo()
+{
+ var a = 42;
+ var b = foo();
+ return a + b;
+}
+//# sourceURL=blackboxed-script.js
+`);
+
+ await session.evaluate(
+`function notBlackboxedFoo()
+{
+ var a = 42;
+ var b = blackboxedBoo();
+ return a + b;
+}
+
+function blackboxedFoo()
+{
+ var a = 42;
+ var b = notBlackboxedFoo();
+ return a + b;
+}
+
+function notBlackboxedBoo()
+{
+ var a = 42;
+ var b = blackboxedFoo();
+ return a + b;
+}
+//# sourceURL=mixed-source.js
+`);
+
+ await session.evaluate(`
+
+
+
+
+
+function testFunction()
+{
+ notBlackboxedBoo(); // for setup ranges and stepOut
+ notBlackboxedBoo(); // for stepIn
+}
+
+function foo()
+{
+ debugger;
+ return 239;
+}
+ `);
+
+ await dp.Debugger.enable();
+ session.evaluate('setTimeout(testFunction, 0);');
+
+ var response = await dp.Debugger.oncePaused();
+ printCallFrames(response);
+ var scriptId = response.params.callFrames[2].location.scriptId;
+
+ printError(await dp.Debugger.setBlackboxedRanges({
+ scriptId: response.params.callFrames[1].location.scriptId,
+ positions: [{lineNumber: 0, columnNumber: 0}] // blackbox ranges for blackboxed.js
+ }));
+
+ var incorrectPositions = [
+ [{lineNumber: 0, columnNumber: 0}, {lineNumber: 0, columnNumber: 0}],
+ [{lineNumber: 0, columnNumber: 1}, {lineNumber: 0, columnNumber: 0}],
+ [{lineNumber: 0, columnNumber: -1}],
+ ];
+ for (var positions of incorrectPositions) {
+ testRunner.log('Try to set positions: ' + JSON.stringify(positions));
+ printError(await dp.Debugger.setBlackboxedRanges({scriptId, positions}));
+ }
+
+ await dp.Debugger.setBlackboxedRanges({
+ scriptId,
+ positions: [{lineNumber: 6, columnNumber: 0}, {lineNumber: 14, columnNumber: 0}] // blackbox ranges for mixed.js
+ });
+
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker-expected.txt
index d6da87d7..492170a 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker-expected.txt
@@ -1,5 +1,4 @@
Tests that setTimeout callback will not fire while script execution is paused.Bug 377926.
-
Started worker
Worker created
SUCCESS: Worker paused
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.html
deleted file mode 100644
index 7853e5d..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-var worker;
-
-function startWorker()
-{
- worker = new Worker("resources/dedicated-worker-suspend-setTimeout.js");
- worker. { };
- worker.postMessage(1);
- log("Started worker");
-}
-
-
-function test()
-{
-
- var workerId;
- var workerRequestId = 1;
- function sendCommandToWorker(method, params)
- {
- var requestId = workerRequestId++;
- InspectorTest.sendCommand("Target.sendMessageToTarget",
- {
- "targetId": workerId,
- "message": JSON.stringify({ "method": method,
- "params": params,
- "id": requestId })
- });
- return requestId;
- }
-
- function didEnableWorkerDebugging(messageObject)
- {
- if ("error" in messageObject) {
- InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
- InspectorTest.completeTest();
- }
- }
- InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitForDebuggerOnStart: true}, didEnableWorkerDebugging);
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()" });
-
- InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObject)
- {
- workerId = messageObject["params"]["targetInfo"]["targetId"];
- InspectorTest.log("Worker created");
- sendCommandToWorker("Debugger.enable", {});
- sendCommandToWorker("Runtime.runIfWaitingForDebugger", {});
- }
-
- var pauseCount = 0;
- var evalRequestId;
- InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(messageObject)
- {
- var message = JSON.parse(messageObject["params"]["message"]);
- if (message["method"] === "Debugger.paused") {
- InspectorTest.log("SUCCESS: Worker paused");
- if (++pauseCount === 1) {
- evalRequestId = sendCommandToWorker("Runtime.evaluate", { "expression": "global_value" });
- } else {
- InspectorTest.log("FAIL: debugger paused second time");
- InspectorTest.completeTest();
- }
- } else if (evalRequestId && message["id"] === evalRequestId) {
- var value = message["result"]["result"]["value"];
- if (value === 1)
- InspectorTest.log("SUCCESS: global_value is 1");
- else
- InspectorTest.log("FAIL: setTimeout callback fired while script execution was paused");
- sendCommandToWorker("Debugger.disable", {});
- InspectorTest.completeTest();
- }
- }
-}
-</script>
-</head>
-<body >
-<p>Tests that setTimeout callback will not fire while script execution is paused.<a href="https://code.google.com/p/chromium/issues/detail?id=377926">Bug 377926.</a>
-</p>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.js
new file mode 100644
index 0000000..f5ffb967
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/suspend-setTimeout-on-pause-in-dedicated-worker.js
@@ -0,0 +1,49 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('Tests that setTimeout callback will not fire while script execution is paused.Bug 377926.');
+
+ var workerId;
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params) {
+ var message = {method, params, id: workerRequestId};
+ dp.Target.sendMessageToTarget({targetId: workerId, message: JSON.stringify(message)});
+ return workerRequestId++;
+ }
+
+ dp.Target.setAutoAttach({autoAttach: true, waitForDebuggerOnStart: true});
+ await session.evaluate(`
+ window.worker = new Worker('${testRunner.url('resources/dedicated-worker-suspend-setTimeout.js')}');
+ window.worker. { };
+ window.worker.postMessage(1);
+ `);
+ testRunner.log('Started worker');
+
+ var messageObject = await dp.Target.onceAttachedToTarget();
+ workerId = messageObject.params.targetInfo.targetId;
+ testRunner.log('Worker created');
+
+ sendCommandToWorker('Debugger.enable', {});
+ sendCommandToWorker('Runtime.runIfWaitingForDebugger', {});
+
+ var pauseCount = 0;
+ var evalRequestId;
+ dp.Target.onReceivedMessageFromTarget(async messageObject => {
+ var message = JSON.parse(messageObject.params.message);
+ if (message.method === 'Debugger.paused') {
+ testRunner.log('SUCCESS: Worker paused');
+ if (++pauseCount === 1) {
+ evalRequestId = sendCommandToWorker('Runtime.evaluate', {expression: 'global_value'});
+ } else {
+ testRunner.log('FAIL: debugger paused second time');
+ testRunner.completeTest();
+ }
+ } else if (evalRequestId && message.id === evalRequestId) {
+ var value = message.result.result.value;
+ if (value === 1)
+ testRunner.log('SUCCESS: global_value is 1');
+ else
+ testRunner.log('FAIL: setTimeout callback fired while script execution was paused');
+ sendCommandToWorker('Debugger.disable', {});
+ testRunner.completeTest();
+ }
+ });
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes-expected.txt
index ed52d23..55d32b9 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes-expected.txt
@@ -1,3 +1,4 @@
+
Paused on 'debugger;'
Variable value changed
Stacktrace re-read again
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.html
deleted file mode 100644
index 20004b4..0000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-function TestFunction()
-{
- var a = 2;
- debugger;
- debugger;
-}
-
-function test()
-{
- var newVariableValue = 55;
-
- InspectorTest.sendCommand("Debugger.enable", {});
-
- InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused;
-
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(TestFunction, 0)" });
-
- function handleDebuggerPaused(messageObject)
- {
- InspectorTest.log("Paused on 'debugger;'");
- InspectorTest.eventHandler["Debugger.paused"] = undefined;
-
- var topFrame = messageObject.params.callFrames[0];
- var topFrameId = topFrame.callFrameId;
- InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { "callFrameId": topFrameId, "expression": "a = " + newVariableValue }, callbackChangeValue);
- }
-
- function callbackChangeValue(response)
- {
- InspectorTest.log("Variable value changed");
- InspectorTest.eventHandler["Debugger.paused"] = callbackGetBacktrace;
- InspectorTest.sendCommand("Debugger.resume", { });
- }
-
- function callbackGetBacktrace(response)
- {
- InspectorTest.log("Stacktrace re-read again");
- var localScope = response.params.callFrames[0].scopeChain[0];
- InspectorTest.sendCommand("Runtime.getProperties", { "objectId": localScope.object.objectId }, callbackGetProperties);
- }
-
- function callbackGetProperties(response)
- {
- InspectorTest.log("Scope variables downloaded anew");
- var varNamedA;
- var propertyList = response.result.result;
- for (var i = 0; i < propertyList.length; i++) {
- if (propertyList[i].name === "a") {
- varNamedA = propertyList[i];
- break;
- }
- }
- if (varNamedA) {
- var actualValue = varNamedA.value.value;
- InspectorTest.log("New variable is " + actualValue + ", expected is " + newVariableValue + ", old was: 2");
- InspectorTest.log(actualValue == newVariableValue ? "SUCCESS" : "FAIL");
- } else {
- InspectorTest.log("Failed to find variable in scope");
- }
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body >
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.js
new file mode 100644
index 0000000..09e007d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/updateCallFrameScopes.js
@@ -0,0 +1,41 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ var newVariableValue = 55;
+
+ dp.Debugger.enable();
+ dp.Runtime.evaluate({expression: `
+ function TestFunction() {
+ var a = 2;
+ debugger;
+ debugger;
+ }
+ setTimeout(TestFunction, 0);
+ `});
+
+ var messageObject = await dp.Debugger.oncePaused();
+ testRunner.log(`Paused on 'debugger;'`);
+ var topFrame = messageObject.params.callFrames[0];
+ var topFrameId = topFrame.callFrameId;
+
+ dp.Debugger.evaluateOnCallFrame({callFrameId: topFrameId, expression: 'a = ' + newVariableValue });
+ testRunner.log('Variable value changed');
+ dp.Debugger.resume();
+
+ var response = await dp.Debugger.oncePaused();
+ testRunner.log('Stacktrace re-read again');
+ var localScope = response.params.callFrames[0].scopeChain[0];
+
+ response = await dp.Runtime.getProperties({objectId: localScope.object.objectId });
+ testRunner.log('Scope variables downloaded anew');
+ var propertyList = response.result.result;
+ var varNamedA = propertyList.find(x => x.name === 'a');
+ if (varNamedA) {
+ var actualValue = varNamedA.value.value;
+ testRunner.log('New variable is ' + actualValue + ', expected is ' + newVariableValue + ', old was: 2');
+ testRunner.log(actualValue == newVariableValue ? 'SUCCESS' : 'FAIL');
+ } else {
+ testRunner.log('Failed to find variable in scope');
+ }
+ testRunner.completeTest();
+})
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js b/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
index ca43106..f2c60bad 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
@@ -312,7 +312,7 @@
var eventName = match[3];
eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1);
if (match[1] === 'once')
- return () => this._waitForEvent(`${agentName}.${eventName}`);
+ return eventMatcher => this._waitForEvent(`${agentName}.${eventName}`, eventMatcher);
if (match[1] === 'off')
return listener => this._removeEventHandler(`${agentName}.${eventName}`, listener);
return listener => this._addEventHandler(`${agentName}.${eventName}`, listener);
@@ -335,9 +335,11 @@
this._eventHandlers.set(eventName, handlers);
}
- _waitForEvent(eventName) {
+ _waitForEvent(eventName, eventMatcher) {
return new Promise(callback => {
var handler = result => {
+ if (eventMatcher && !eventMatcher(result))
+ return;
this._removeEventHandler(eventName, handler);
callback(result);
};