Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/sources/dont-diverge-script-evaluated-twice.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/sources/dont-diverge-script-evaluated-twice.html b/third_party/WebKit/LayoutTests/inspector/sources/dont-diverge-script-evaluated-twice.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4fe4be73a9f5294eaa8666b1e404c1f9e5147ba7 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/sources/dont-diverge-script-evaluated-twice.html |
| @@ -0,0 +1,55 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/debugger-test.js"></script> |
| +<script> |
| + |
| +var test = function() |
| +{ |
| + const scriptSource = "239\n//# sourceURL=test.js"; |
| + const changedScriptSource = "42\n//# sourceURL=test.js"; |
| + |
| + InspectorTest.startDebuggerTest(step1); |
| + |
| + function step1() |
| + { |
| + InspectorTest.waitForScriptSource("test.js", step2); |
| + InspectorTest.evaluateInPage(scriptSource); |
| + } |
| + |
| + function step2(uiSourceCode) |
| + { |
| + InspectorTest.addSnifferPromise(WebInspector.ResourceScriptFile.prototype, "_mappingCheckedForTest").then(() => step3(uiSourceCode)); |
| + InspectorTest.showScriptSource("test.js"); |
| + } |
| + |
| + function step3(uiSourceCode) |
| + { |
| + var mainTarget = WebInspector.targetManager.mainTarget(); |
| + var scriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(uiSourceCode, mainTarget); |
| + if (!scriptFile) { |
| + InspectorTest.addResult("[FAIL]: no script file for test.js"); |
| + InspectorTest.completeDebuggerTest(); |
|
lushnikov
2016/10/03 20:07:53
return;
kozy
2016/10/03 20:45:18
Done.
|
| + } |
| + if (scriptFile.hasDivergedFromVM() || scriptFile.isDivergingFromVM()) { |
| + InspectorTest.addResult("[FAIL]: script file is diverged from VM"); |
| + InspectorTest.completeDebuggerTest(); |
| + } |
| + |
| + scriptFile.addEventListener(WebInspector.ResourceScriptFile.Events.DidDivergeFromVM, dumpDivergeFromVM, this); |
|
lushnikov
2016/10/03 20:07:53
scriptFile is a new one; this won't fire
kozy
2016/10/03 20:45:18
Done.
|
| + InspectorTest.addSnifferPromise(WebInspector.JavaScriptSourceFrame.prototype, "_didDivergeFromVM").then(dumpDivergeFromVM); |
| + InspectorTest.addSnifferPromise(WebInspector.ResourceScriptFile.prototype, "_mappingCheckedForTest").then(() => InspectorTest.completeDebuggerTest()); |
| + InspectorTest.evaluateInPage(changedScriptSource); |
| + } |
| + |
| + function dumpDivergeFromVM() |
| + { |
| + InspectorTest.addResult("[FAIL]: script file was diverged from VM"); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Checks that script evaluated twice with different source and the same sourceURL won't be diverged from VM.</p> |
| +</body> |
| +</html> |